Install the following packages one-by-one via Command Palette (Shift+Ctrl+P, or Shift+Cmd+P on macOS) > search for “Package Control: Install Package” > search for each package in turn. Close and re-open Sublime Text after each one finishes installing.
A general Markdown plugin. This will give you most of what you will need for working with Markdown files, including doing things like collapsing URLs so that they are hidden. The main thing it doesn’t include is a build system but the MarkdownPreview package has this, so install that as well!
Note: on macOS this package can introduce a key binding conflict as it overwrites Ctrl+1/2/3. This isn’t an issue if you don’t use those bindings, but if you do then create a user key binding (see below) to fix it.
To change the colour scheme of Markdown text windows:
{
"extensions":
[
"md"
],
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"save_on_focus_lost": true,
"line_numbers": true,
"translate_tabs_to_spaces": false
}
If Sublime Text starts to think that text files .txt
are
Markdown files .md
:
Allows you to view rendered Markdown in your browser. In other words, it allows you to create an HTML file from a Markdown file.
The correct build system should be selected by default, meaning that you can just press Ctrl+B on Linux/Windows or Cmd+B on macOS and have it work immediately. Optionally, you can create a user key binding (see below) to immediately open the current Markdown file as a rendered HTML page in your web browser.
Easily align columns in Markdown tables. The default key binding for this is Shift+Ctrl+Alt+T.
To create custom key bindings, go to “Preferences” > “Key Bindings” and edit the right-hand side, eg by entering the following:
[
/* Markdown */
// Render Markdown in browser
{ "keys": ["shift+alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser": "markdown"} },
// Overwrite MardownEditing's key bindings
{ "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } },
{ "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } },
{ "keys": ["ctrl+5"], "command": "focus_group", "args": { "group": 4 } },
]
If you try to build a Markdown file (if you have an .md
file open and either press Ctrl+B/Cmd+B or go “Tools” > “Build”) and
it doesn’t work, take a look at the bottom left corner. If it has the
message “No build system” then take a look in the “Tools” > “Build
System” menu. If that contains “Markdown” then it means that Sublime
Text has a problem with the syntax highlighting (color scheme),
not the build system itself. You can double check this by looking in the
“View” > “Syntax” menu (or at the bottom right corner where the
detected syntax is shown - clicking on this will being up the same menu)
and seeing that “Markdown” does not exist.
Fix this problem by uninstalling and re-installing the MarkdownEditing package:
How to have LaTeX equations in your Markdown be rendered by Markdown Preview in Sublime Text:
{
"js": [
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js",
"res://MarkdownPreview/js/math_config.js",
]
}
{
"markdown_extensions": [
{
"pymdownx.arithmatex": {
"generic": true
}
}
]
}
markdown_extensions
settings when
enabling Arithmatex. To avoid this you need to manually enable them all
again: find markdown_extensions
in the Default settings (on
the left-hand side) and copy-paste that section into the User settings
(on the right-hand side).{
"js": [
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js",
"res://MarkdownPreview/js/math_config.js",
],
"markdown_extensions": [
{
"pymdownx.arithmatex": {
"generic": true
}
},
// Python Markdown Extra with SuperFences.
// You can't include "extra" and "superfences"
// as "fenced_code" can not be included with "superfences",
// so we include the pieces separately.
"markdown.extensions.footnotes",
"markdown.extensions.attr_list",
"markdown.extensions.def_list",
"markdown.extensions.tables",
"markdown.extensions.abbr",
"pymdownx.betterem",
{
"markdown.extensions.codehilite": {
"guess_lang": false
}
},
// Extra's Markdown parsing in raw HTML cannot be
// included by itself, but "pymdownx" exposes it so we can.
"pymdownx.extrarawhtml",
// More default Python Markdown extensions
{
"markdown.extensions.toc":
{
"permalink": "\ue157"
}
},
"markdown.extensions.meta",
"markdown.extensions.sane_lists",
"markdown.extensions.smarty",
"markdown.extensions.wikilinks",
"markdown.extensions.admonition",
// PyMdown extensions that help give a GitHub-ish feel
{
"pymdownx.superfences": { // Nested fences and UML support
"custom_fences": [
{
"name": "flow",
"class": "uml-flowchart",
"format": {"!!python/name": "pymdownx.superfences.fence_code_format"}
},
{
"name": "sequence",
"class": "uml-sequence-diagram",
"format": {"!!python/name": "pymdownx.superfences.fence_code_format"}
}
]
}
},
{
"pymdownx.magiclink": { // Auto linkify URLs and email addresses
"repo_url_shortener": true,
"repo_url_shorthand": true
}
},
"pymdownx.tasklist", // Task lists
{
"pymdownx.tilde": { // Provide ~~delete~~
"subscript": false
}
},
{
"pymdownx.emoji": { // Provide GitHub's emojis
"emoji_index": {"!!python/name": "pymdownx.emoji.gemoji"},
"emoji_generator": {"!!python/name": "pymdownx.emoji.to_png"},
"alt": "short",
"options": {
"attributes": {
"align": "absmiddle",
"height": "20px",
"width": "20px"
},
"image_path": "https://github.githubassets.com/images/icons/emoji/unicode/",
"non_standard_image_path": "https://github.githubassets.com/images/icons/emoji/"
}
}
}
]
}
Markdown Preview uses MathJax to turn LaTeX equations into HTML. The settings for how this works are contained in two files:
/home/<username>/.config/sublime-text/Packages/User/MarkdownPreview.sublime-settings
on Linux/Users/<username>/Library/Application Support/Sublime Text/Packages/User/MarkdownPreview.sublime-settings
on macOS