How to include Bike highlighting in pandoc exports to MS Word docx
-
In addition to the basic pandoc command line for
Bike -> MS Word
exports:-
pandoc -f html -t docx note.bike -o note.docx
-
(which already exports Bike's bold , italic
code
andstrikeformatting)
-
-
we can additionally export Bike highlights by adding references – in our command line – to two utility files (
reference.docx
, anddocxHighlight.lua
), which can be anywhere on your system. -
In the command line below we're not giving a full path to either of those files, so we're assuming that they are in the same folder as your
.bike
file:-
pandoc -f html -t docx note.bike -o note.docx --reference-doc=reference.docx --lua-filter=docxHighlight.lua
-
The
--reference-doc
option points to an MS Word file which contains a definition of a custom style calledMarkedYellow.
-
The
--lua-filter
option points to a file containing a snippet of code in theLua
scripting language, to which pandoc provides a special interface.
This particular snippet maps Bike highlighting onto the customMarkedYellow
style in MS Word.
-
Here are zipped copies of those two files, together with a note.bike
file for testing:
bikePandocExample.zip (18.0 KB)
Pandoc itself can be installed with brew install pandoc
Note: If you want to further tweak the appearance of outlines exported from Bike to MSWord by that pandoc command line, you can adjust the existing style definitions in reference.docx
Expand disclosure triangle to view the Lua snippet
function Span(elem)
if FORMAT:match 'docx' and "mark" == elem.classes[1] then
elem.attributes['custom-style'] = 'MarkYellow'
end
return elem
end