Select Page

After a couple of years of writing all my documentation in LaTeX, I’m back at MS Word again for my job.
It is itchy at all sides of my body, but I have to accept this downgrade in making documents.
And yes, I get it. LaTeX has a steep learning curve and it is not useful if only a few can work with it.

Fortunately, at the software group I’m not the only one who has something against Word.
It is binary, thus not practical to use with version control and you cannot use it with your favorite editor.
However, still a bunch of the programmers are not familiar with LaTeX, hence we chose to find an optimum in between.

The solution is: Markdown.
A plain text-based markup language which stands out by its simplicity.

Setting up markdown in Sublime Text 3

I wanted it to be readable for everybody, including digital illiterates, therefor it needs to be converted to HTML.
Next to that, I want to do it all from my favorite editor Sublime Text 3.

The first step is to get the markdown syntax recognized in Sublime. I prefer the MarkdownExtended package and you can install it through the package manager (Ctrl + Shift + P) in Sublime Text. In the package manager type Package Control: Install Package, hit Enter and search for MarkdownExtended.

The next step is to install a build system that generates the markdown HTML file. I found the best tool for this is Markdown Preview from Facelessuser on Github. It builds your HTML file, but also lets you preview the file in the browser. There is no need to download the repository, because this previewer can also be installed through the package manager by searching for Markdown Preview.

The Markdown Preview package lets you generate a preview in the browser by opening command palette (Ctrl + shift + P), and search for Preview in Browser.

This is too much of a hassle for me. Too much buttons to press, I want a short cut for that.

Fortunately, this is possible. I assigned Alt + M as a shortcut to render the preview. It is added to Sublime by pasting the following line to Key Bindings under Preferences:

{“keys”: [“alt+m”], “command”: “markdown_preview”, “args”: {“target”: “browser”, “parser”:”markdown”} }

If not already set, then add the following line also to build the HTML file with Ctrl + B:

{ “keys”: [“ctrl+b”], “command”: “build” }

Now you key binding looks like (don’t forget to add the ‘,’ after the first line):

[
{“keys”: [“alt+m”], “command”: “markdown_preview”, “args”: {“target”: “browser”, “parser”:”markdown”} },
{ “keys”: [“ctrl+b”], “command”: “build” }
]

Extra tip: Auto reload

This is a very useful one, an auto reload function so that the HTML is rebuild and updated in the browser after every change to your markdown file.

First, install this package with the package manager by searching for LiveReload.
Second, enable the auto reload by adding the following line to the MarkdownPreview.sublime-settings:

“enable_autoreload”: true

You can use it by opening command palette (Ctrl + shift + P), type LiveReload: Enable/disable plug-ins and select Enable: Simple Reload with delay (400ms). It is better to use the one with delay, to avoid reloading to quick, which results in displaying the old HTML file.

Now you are ready to go and type the documents you dreamed about.