LyX and markdown / pandoc
julien.dutant at gmail.com
Sat Feb 13 16:42:17 UTC 2021
Hi Lyx devs,
tl;dr: interfacing LyX with pandoc's native or markdown formats would
greatly expand its reach by adding many formats to the outputs it can
generate and by making it by far the best visual editor for markdown
available. What's the best way to go about it?
I love LyX and have been using it for many years, I'm very grateful for
your work. Like many people in academia and developers I'm also using
markdown more and more, including for generating LaTeX. Pandoc (the
"universal document converter", https://pandoc.org/) has a rich flavour of
markdown that can cover most of academic needs and can be extended through
'filters. As I explain in this post:
https://github.com/jgm/pandoc/issues/5555 on Pandoc's repo, there is a need
for markdown visual editors and the few ones that exist are nowhere near as
feature-rich and fast as an editor like LyX.
But it would only take for LyX to read/write pandoc's markdown or native
formats, or for Pandoc to read Lyx's format, to instantly turn LyX into a
visual markdown editor. The layout system could be use to have a "markdown"
class, and the extension system could even be used in combination with
Pandoc's filters to extend markdown.
In addition, doing this would allow LyX to generate all the outputs formats
that Pandoc can generate: ebook, JATS XML, RST, various flavours of
markdown, 6 slides formats, etc., etc., without going through LaTeX. I
think this would significantly increase LyX's audience, esp. among
Pandoc works by converting all documents to its Abstract Syntax Tree, which
is simple and systematically specified (
). Pandoc can read it from a JSON file; alternatively, Pandoc's markdown
can match it pretty closely. So all it would take would be either:
1) that Lyx reads and writes Pandoc's markdown or JSON
2) that Pandoc reads and writes Lyx's format .lyx .
The first would be developping something like the DocBook or LyXHTML
extension in Lyx. The second would be developing a reader and writer for
Pandoc (in Haskell).
It seems to me that the second line is easier (because there's already all
the library to build pandoc AST objects in Haskell).
There are people in the pandoc community that might get involved. Or
someone could develop something on the LyX side (happy to get involved but
in the longer term). The main obstacle, however, is that there doesn't seem
to be a specification of LyX format, and (if I understand well) we can't
rely on it being stable between releases (though we could rely on LyX's own
conversion between versions of the LyX format).
Around version 2.1 there was a "road to XML" but that has been abandoned,
I'd be curious to have your thoughts on the project and what you think
would be the best way to go about it and the main hurdles.
Department of Philosophy, King's College London
julien.dutant at kcl.ac.uk
London WC2R 2LS
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lyx-devel