From Markdown files to LibreOffice documents with Pandoc
I edit a substantial number of Markdown and MediaWiki text files and it isn't infrequent that I need some of them available in a different format. Pandoc command-line utility is included in one of my Windows application and it can be used to generate Word (DOCX) and LibreOffice (ODT) file from markdown text files.
There is a dedicated section in the configuration file (see figure below) for setting Pandoc's command-line arguments. OutputFormat and OuputDir are self-explanatory, while DataDir is the directory name relative to the user home directory where Pandoc's data files are located.
This video shows a LibreOffice document generated from a mediawiki file.
Lua filter
In the Pandoc section of the configuration file, there is the possibility to include extra options to the command-line arguments, like for example the table of contents ( --toc ) or set a Lua extension,
Lua filters can be particularly useful, for instance, I can divide longer and more complex documents into different files. The code snippet below shows how to manage inside the same document several markdown files.
# Chapter I
```{.include}
C:\Users\Seve\Documents\chapter1.md
```
****
# Chapter II
```{.include}
C:\Users\Seve\Documents\chapter2.md
```
The filter should be located in the DataDir filters subfolder and set the options value to:
-L include_files.lua
The reference.odt and reference.docx files define the style for the output ODT or DOCX documents .
Note to HTML
Vim-notes plugin also support Pandoc for generating HTML files by setting the following global variable in the .vimrc.
let g:notes_markdown_program ='C:\Users\Seve\AppData\Local\Programs\WinDiction\pandoc.exe'