Direct hit scene
I've been thinking about what format to use to store documents better. have been using Google Docs, but its format is not public, upload/download need to convert the format, the conversion will inevitably lose some information. Then thought, that is still pure text or markdown bar.
But Markdown dialect a lot, choose which good? I examined the following three.
Pandoc. John Macfarlane wrote the Universal converter. One drawback to me is that it's the Haskell language.
Commonmark. This is a great attempt by John Macfarlane to standardize the markdown. He gives the C language and JS implementation, where the C language is easy to compile in Windows, the code is easy to understand. Unfortunately, no one bought it.
GitHub flavored Markdown. This is probably the standard of fact now. Because the code is hosted on GitHub, it naturally follows GitHub's requirements when it comes to writing documents. I didn't find it in the open source implementation. However, Atom.io is a github company, and the markdown implementation of this editor is marked. I tried it and it was good.
So I took marked as an example and wrote a simple script to convert the markdown file to HTML
var marked = require (' marked '); var fs = require (' FS '); var inputfilename=process.argv[2]; var outputfilename=inputfilename.replace ('. MD ', '. html '); Console.log ("Processing" +inputfilename); var markdownstring=fs.readfilesync (inputfilename, "UTF8"); Marked.setoptions ({highlight:function (code) {return require (' Highlight.js '). Highlightauto (code). Value; }}); htmlbody=marked (markdownstring); Html= "<! DOCTYPE html><Html><Head><Metahttp-equiv=\ "Content-type\"Content=\ "Text/html; charset=utf-8\ ">\n" + "< Link rel=\ "stylesheet\" href= \ "Https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/ styles/default.min.css\ ">\n" + "</head><body> "+htmlbody+" </< Span class= "title" >body></html> "Fs.writefilesync (outputfilename , html,{encoding: "UTF8"});
In the HTML header plus a line of Mathjax JS Link, you can support the mathematical formula in the markdown.
The choice of markdown