Skip to content

Markdown preview templates

bjones1 edited this page May 4, 2015 · 4 revisions

A Markdown template is simple some text, which is prepended to the source file before processing it with the Markdown engine. Text from a template is not saved into the Markdown (.md) source file.

There are two known cases, when templates are useful:

  1. Include custom JavaScript:

        <script type="text/javascript"
            src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
        </script>
    

    This example includes the MathJax processor. Recall that Markdown allows direct inclusion in the source of HTML tags.

  2. Tune CSS styles

        <style type="text/css">
            body {color: white; background: black;}
        </style>

Your own templates

Currently Enki includes three templates:

  • Default
  • White on black text style
  • MathJax script included

To create your own templates, just put the text you want to be prepended to a source Markdown document in a file, saving this file in the directory ~/.enki/markdown-templates. The name of file specifies the name of your template.

Default templates are located in the directory /usr/lib/python2.7/dist-packages/enki/plugins/preview/templates. (Note: The Enki installation directory may vary depending on your system.)

If you've created a useful template, please share it with the team; it might be included in Enki's default set.