Is it possible to write a custom output writer for Pandoc?
For example, suppose I want to convert a document:
pandoc -f markdown -t myCustomMarkup asdf.md
Does Pandoc have a way I can specify the conversion rules for myCustomMarkup
? (e.g. I could specify that text that had the 'bold' attribute should map to <bold>text</bold>
, and so on for all features/attributes that Pandoc recognises).
Can anyone point me to some documentation as to how I can implement my own? I can't seem to find any mention of this.
(Additionally, is there a way to "plug in" a writer defined in a file without having to (say) re-compile pandoc? e.g. pandoc -f markdown -t myCustomMarkup --writerpath=path/to/my/writer asdf.md
)
You can use the program pandoc on the SCF Linux and Mac machines (via the terminal window) to convert from formats such as HTML, LaTeX and Markdown to formats such as HTML, LaTeX, Word, OpenOffice, and PDF, among others.
Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.
As you can see, first, write pandoc to execute any pandoc command, and then write the file name of a file with extension which you want to convert to a markdown file. The -o stands for output file name and provide name of the file with extension to which it should be converted.
There's no easy way to do this with current pandoc, but the next version of pandoc will contain code that allows you to write custom writers with a bit of easy lua scripting. (The code for this is already in the master
branch in http://github.com/jgm/pandoc.) You'll be able to do
pandoc -t myfunkyformat.lua myfile.md
Here's an example of what a custom writer script might look like: https://github.com/jgm/pandoc/blob/master/data/sample.lua
You can use the code now if you compile from source: https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With