Welcome to MarkdownLivePreview's documentation!

MarkdownLivePreview's logo

MarkdownLivePreview is a Sublime Text 3 plugin to preview your markdown as you type, right in Sublime Text itself, without any dependency!

It's very easy to use, but there's a few things that you might want to be aware of... So, let's get started

Installation

Using Package Control

You can really easily install MarkdownLivePreview by using Package Control.

If it's not already, you need to install it first.

Note

If you're using the latest build of Sublime Text 3, you can just do Tools → Install Package Control…

  • Open up the command palette (ctrl+shift+p)
  • Search up Package Control: Install Package (might take a few seconds)
  • In the panel that just showed up, search for MarkdownLivePreview

Done! You have now access to every single features of MarkdownLivePreview! 😉

Using git

$ cd "%APPDATA%\Sublime Text 3\Packages"             # on Windows
$ cd ~/Library/Application\ Support/Sublime\ Text\ 3 # on Mac
$ cd ~/.config/sublime-text-3                        # on Linux

$ git clone "https://github.com/math2001/MarkdownLivePreview"

So, which one do I pick?!

I depends of what you want to do. If you want to just use MarkdownLivePreview, pick the first solution, you'll get every update automatically. But if you want to contribute, then choose the second solution.

Usage

Previewing

As told in the introduction, MarkdownLivePreview is very easy to use:

  • open a markdown file
  • press alt+m
  • or select in the command palette MarkdownLivePreview: Edit Current File

Note

The preview of unsaved markdown files is currently not supported. It should be fixed soon.

Tip

Markdown Extended is supported too!

That's it. That's all you need to do to preview your markdown!

Custom CSS

If you want to, you can add custom CSS to the MarkdownLivePreview's default stylesheet.

Just search for MarkdownLivePreview: Edit Custom CSS File in the command palette (ctrl+shift+p). It will open a file in which you can add some CSS that will be added to the normal CSS.

Bug

Comments in the CSS is interpreted weirdly by Sublime Text's phantoms. After a few tests, I think that everything that is bellow a comment is ignored.

If you want to be sure that your CSS works, don't put any comments in it

Share your tweaks!

If you think that other users would enjoy your added CSS, then raise an issue, or PR the GitHub repo to share your tweaks!

Clearing the cache

MarkdownLivePreview has a cache system to store images you load from internet. You can clear this cache by searching up in the command palette MarkdownLivePreview: Clear the cache.

Tip

The cache is one simple file called MarkdownLivePreviewCache, which is located in your temp folder. To know where it is, you can open the Sublime Text console (ctrl+` or View → Show Console), and paste this in:

import tempfile; print(tempfile.gettempdir())

Custom settings for the preview

Sublime Text makes it easy to set custom settings for a specific type of view. For example, markdown, python, etc. MarkdownLivePreview takes advantage of that: the preview view (the view on the right) is a specific syntax (called — sorry for the originality — MarkdownLivePreviewSyntax). So, to change this, you can focus the right view, open up the command palette (ctrl+shift+p), and search up Preferences: Settings Syntax Specific. In here, you can specify any settings that is going to be applied only to this view.

The hacky part

In fact, MarkdownLivePreview parses those settings, and looks for specific ones:

  • show_tabs
  • show_minimap
  • show_status_bar
  • show_sidebar
  • show_menus

Those settings aren't supported by default because they affect the entire window instead of just the view. But MarkdownLivePreview will look for them in your preview's settings, and hide/show the tabs, the minimap, etc...

As you probably guessed those settings takes a bool for value (true or false).

Recommendation

Here's what I'd recommend (and use):

{
    "show_menus": false,
    "show_tabs": false,
    "show_minimap": false,
    "gutter": false,
    "rulers": [],
    "word_wrap": true
}

Tip

On Windows at least, you can press alt to focus (so show) the menu, even if they're originally hidden

That's it! I hope you'll enjoy using this package! If it's the case, please let your friends know about it, and even myself by sending me a tweet or staring the repo !