pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
600 stars 165 forks source link

Passing extension and lua filter at the same time? #263

Closed owoodhansen closed 1 year ago

owoodhansen commented 1 year ago

I can't seem to combine the markdown extension Ext_mark (reads "==text==" as used in obsidian and highlights text in docx) and the lua filter include-files in the same pandoc conversion. I can make both work on their own, but when I combine both, the cmd flag -f markdown+mark is ignored. The order of -L and -f doesn't change anything.

@tarleb suggested to ensure that the pandoc.read function uses markdown+mark as format. I've played around, but cannot figure out how to specify that in the .lua file

If I understood Tarleb correctly, I should specify the extension in line 91-95 of include-files.lua, but how?

local contents = pandoc.read(
          fh:read '*a',
          format,
          PANDOC_READER_OPTIONS
        ).blocks
jgm commented 1 year ago

It might matter what version of pandoc you're using, so let us know.

tarleb commented 1 year ago

Looking at the code, I think that adding format="markdown+mark" to the attributes of the include block should be enough.

owoodhansen commented 1 year ago

Thank you both for the help so far (and your great work). I'm using Pandoc 3.0. (Also on windows, running pandoc in cmd)

Ahh it worked now. I added your suggestion in line 66 rather than in line 91-95.

tarleb commented 1 year ago

Good to hear! I assume its ok to close this?

owoodhansen commented 1 year ago

Yes, I should have done that myself I now realise. Sorry, still learning my way around this.