Sorry for the late reply. In my case, I'd still like to recognize the contents inside the block.

On Tuesday, August 17, 2021 at 12:37:37 PM UTC+2 William Lupton wrote:
Could pandoc.read(markup, "html") help?

On Mon, 16 Aug 2021 at 23:09, John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

I'm afraid you'll have to write some parsing code...

pompez <martins...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I'm starting out with Lua filters and apologize for this possibly already
> answered question. You can also read this question on StackOverflow
> <https://stackoverflow.com/questions/68809527/is-there-a-way-to-change-the-way-pandoc-parses-html-inside-of-markdown-documents>
> .
>
> I'm using Pandoc to convert markdown to HTML. My markdown files also
> contain some raw HTML. In the examples, I'll be using `<mark>` and `<u>`.
>
> Let's say I want to change every `<mark>` to a `<u>` tag. We parse the
> input as HTML and look at the AST.
>
> ```
> $ echo '<u>foo</u> & <mark>bar</mark>' | pandoc --from=html --to native
> [Plain [Underline [Str "foo"],Space,Str "&",Space,Span ("", ["mark"],[])
> [Str "bar"]]]
> ```
>
> On this structure, we can use a simple filter which replaces `Span`
> elements representing the `<mark>` tag and replaces with `Underline`
> elements.
>
> ```
> function Span(elem)
>     if elem.classes[1]:gmatch('mark') then
>         return pandoc.Underline(elem.content)
>     end
> end
> ```
>
> ```
> [Plain [Underline [Str "foo"],Space,Str "&",Space,Underline [Str "bar"]]]
> ```
>
> This is good. But if we parse the same input as markdown, we get a much
> less convenient structure.
>
> ```
> $ echo '<u>foo</u> & <mark>bar</mark>' | pandoc --from=markdown+raw_html
> --to native
> [Para [RawInline (Format "html") "<u>",Str "foo",RawInline (Format "html")
> "</u>",Space,Str "&",Space,RawInline (Format "html") "<mark>",Str
> "bar",RawInline (Format "html") "</mark>"]]
> ```
>
> And if we had some additional criteria by which to replace `<mark>` with
> `<u>` (the content for example), we would have to identify the opening and
> closing `RawInline` elements.
>
> I'm wondering if there is any good solutions to this problem? Is there a
> way to parse HTML in markdown just as HTML would be parsed otherwise? Or is
> there way to solve this in a Lua filter without writing some parsing code?
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/aae29ca7-60ca-4349-af03-939f0ac503efn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/411e9a84-5981-4bd8-b905-914a66d1dc3fn%40googlegroups.com.