It is neither possible nor needed to convert the whole block to HTML within the filter; rather you should just inject the start and end tags: ``````lua -- Create these only once, for speed and resources saving! local pre = pandoc.RawBlock('html', '') local post = pandoc.RawBlock('html', '') function Div (div) -- The order of the classes shouldn't matter! if div.classes:includes('replace-me') then local content = div.content table.insert(content, 1, pre) table.insert(content, post) return content end return nil end `````` Den mån 10 jan. 2022 15:33Tomáš Kruliš skrev: > Hello, > > I would like to ask how you should, in general, detect and manipulate with > Pandoc `block` elements. Currently, I am trying to replace `
class='replace-me'>` tag with `` tag in similar (highly simplified) > HTML file: > > ```.{html} > > >

First line.

>
This should carry on to converted > document.
>

End.

> > > ``` > > I have tried to detect the `
` tag, use `walk_block` to get the > `
` content and put it in `` tag, I also found a code using > `:walk` method. Lastly, I tried to convert `
` content to simple string > and concatenate that in `RawInline` type: > > ```.{lua} > if elem.t == 'Div' and elem.classes[1] == "replace-me" then > content = pandoc.utils.stringify(elem.content) > return pandoc.RawInline('html', '' .. content.. '') > else > return elem > end > ``` > > But none of that is working. I would like to ask you, how to work in > general with `pandoc_walk` or `:walk` (are they the same?) and how to deal > with my specific situation? > Thank you very much for any help, I ope that afterwards I will be able to > help myself a little bit more :) > Regards Tomas > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/590abdf0-6bc5-4f37-a978-a46ad5cff5a8n%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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAzeK-kPd7yHWbtGX%3D363VvcgFUj8gt_vEMUXfGkBd%2Bug%40mail.gmail.com.