Skip to content

Extensions cannot be used with custom writers #8120

@asmaier

Description

@asmaier

Explain the problem.
I created a custom writer in Lua for kramdoc based on pandoc markdown:

function Writer (doc, opts)
    local filter = {
      Math = function(elem)

        local math = elem

        if elem.mathtype == 'DisplayMath' then
            local delimited = '\n$$' .. elem.text ..'$$\n\n'
            math = pandoc.RawInline('markdown', delimited)
        end

        if elem.mathtype == 'InlineMath' then
            local delimited = '$$' .. elem.text ..'$$'
            math = pandoc.RawInline('markdown', delimited)
        end 
        
        return math
      end           
    }
    return pandoc.write(doc:walk(filter), 'markdown', opts)
  end

When using it like this it works:

pandoc -t kramdown.lua -o vector.md vector.tex

However when I try to activate or deactivate extensions by adding or substracting the extensions name to my custom writer (as described at https://pandoc.org/MANUAL.html#extensions) it doesn't work, e.g. when trying to deactivate the extension for smart quotes:

pandoc -t kramdown.lua-smart -o vector.md vector.tex
Error running Lua:
cannot open kramdown.lua-smart: No such file or directory

Obviously activating/deactivating extensions for custom writers doesn't work like for the inbuilt supported formats (I also tried the combinations kramdown-smart.lua or kramdown-smart). Is this a bug/missing feature or is there another way to activate/deactivate extensions when using custom writers?

Pandoc version?
Pandoc 2.18 on Mac OS 10.15.7

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions