I include $\rm \LaTeX$ code for mathematical expressions rendered by MathJax in Markdown source code for Octopress posts. Then I have to adapt the $\rm \LaTeX$ code for kramdown, which is a Markdown parser that converts kramdown code into HTML. For example,
- Add a backslash ‘\’ before an underscore
- Use eight backslashes to stand for a newline in displayed math equations.2
For the second item, I realized that by repeated trials.
Regeneration of the contents in this blog takes more than a minute since jekyll needs to process more than 200 pages. Therefore, a quicker way to verify the Markdown syntax helps.
- Write the $\rm \LaTeX$ code for the equations.
- Use a $\rm \LaTeX$ compiler to ensure that the code for the equations are right.
- Use pandoc to convert the $\rm \LaTeX$ code to Markdown.
- Use kramdown to convert the Markdown (i.e. kramdown) code to HTML.
- Copy and paste the HTML code into the
<body>tag of an HTML file.
- Add references to MathJax and a local configuration file in the
<head>tag in the HTML file.
- Use a web browser to preview the results.
- Correct the Markdown syntax, and repeat steps 4–7 if necessary, until the contents are correctly displayed.
- Copy the kramdown code and paste it under the YAML header in the Markdown source file for an Octopress post.
Therefore, I often excute the following editor commands in Vim.
:" returns the relative path of the file the current buffer :echo expand('%') :!kramdown % > %<.html :sp %<.html