Is there already a markdown to XML parser implemented in Mathematica? I wrote a one for my pelican rewrite, but realized I should have asked here first. Mine is almost certainly faulty in a few major ways (I just don't know them yet) and would much rather use some one else's if it exists.
Asked
Active
Viewed 398 times
11
2 Answers
6
To get the ball rolling, here's my incomplete parser.
And here's a minimal markdown sample.
This is what my markdown parser makes of it, used like so:
CloudExport[
MarkdownToXML[
Import["https://raw.githubusercontent.com/b3m2a1/mathematica-BTools/\
master/Resources/Templates/PacletServer/content/pages/About.md",
"Text"
],
"StripMetaInformation" -> False
],
"HTML",
"user:b3m2a1.testing/mdtest.html",
Permissions -> "Public"
]
CloudObject["https://www.wolframcloud.com/objects/b3m2a1.testing/mdtest.html"]
(Note that it will strip that meta-information header block by default, hence the "StripMetaInformation"->False)
b3m2a1
- 46,870
- 3
- 92
- 239
2
The package "Markdown2WL" attempts that, but unfortunately it is fairly incomplete. Also, see the corresponding Community post.
(In general I like the idea of a Markdown-to-Mathematica converter written in Mathematica.)
Anton Antonov
- 37,787
- 3
- 100
- 178
LibraryLink, rather than introduce theProcessLinkoverhead. And at that point the Markdown spec is simple enough, why not implement it oneself? I think it's a) a manageable problem and b) more easily tweak-able if implemented in Mathematica. But if someone had already done the work to write a"MarkdownLink`"I'd go with that. – b3m2a1 Sep 04 '17 at 16:51