WebStorm 2019.3 Help

Markdown

Markdown is a lightweight markup language for adding formatting elements to plain text. WebStorm recognizes Markdown files, provides a dedicated editor for them, and shows the rendered HTML in a live preview.

The Markdown editor helps you to perform basic editing capabilities: manage headings, apply formatting to text to make it bold or italic, and so on. You can also use completion capabilities to add links to other project documents or images, insert code blocks for various programming languages, and visualize DOT or PlantUML diagrams.

Before you start

Make sure the Markdown bundled plugin is enabled on the Plugins page, see Managing plugins for details.

Preview

By default, the Markdown editor is split into the code editor and the preview pane. Use the Show editor only or Show preview only buttons to show only the code editor or the preview pane.

Markdown editor and live preview pane

You can also manage whether the editor and preview pane are split vertically or horizontally. To do this, open the Settings/Preferences dialog Ctrl+Alt+S, go to the Languages & Frameworks | Markdown page and use the Editor and Preview Panel Layout option.

WebStorm automatically synchronizes the preview with the current caret position in the code editor. Use the Auto-Scroll Preview button Auto-Scroll Preview to turn on or turn off this synchronization.

A handy way to navigate within a markdown document is the Structure view. It displays document headings and enables you to jump to the required paragraph quickly.

Structure tool window

You can choose between the Structure tool window Alt+7 and File Structure popup Ctrl+F12.

Formatting

In the Markdown editor, you can apply basic formatting to text. For example, to make the selected text bold, italic or monospaced, use the Toggle bold mode, Toggle italic mode, and Toggle monospaced mode buttons.

The Markdown editor provides completion for links to files contained in the current project. For example, this can be other markdown documents or images.

Markdown complete a link

If the linked file is not found in the project, the Markdown editor throws a warning.

Code blocks

The editor allows you to insert fenced code blocks for different languages by placing triple backticks (```) before and after the code block.

Markdown insert a fenced code block

Code completion, inspection and intention actions are supported for the selected language.

Markdown completion in fenced code blocks

If these capabilities are not required, you can disable code injection for markdown files. To do this, open Settings/Preferences Ctrl+Alt+S, go to the Languages & Frameworks | Markdown page and use the Disable automatic language injection in code fences option.

Diagrams

WebStorm supports visualizing diagrams in the Markdown preview using the DOT and PlantUML diagramming languages.

PlantUML diagrams in markdown

To visualize a diagram, insert a corresponding code block with the puml or plantuml language. You can copy the code snippets below to see this functionality in action.

```puml A -> B ```
```plantuml digraph Test { A -> B } ```

Custom CSS for preview

The Markdown preview allows you to use custom Style Sheets to render a document. You can specify a custom stylesheet to make basic presentation changes (for example, increase the font size in a preview) or you can provide an entirely new CSS (for instance, if you want to replicate the GitHub Markdown style).

To provide custom Style Sheets, open the Settings/Preferences dialog Ctrl+Alt+S, go to the Languages and Frameworks | Markdown page, and set a path to the required CSS file using the Load from URI option. This path can either be a URL or an absolute/relative path.

Markdown custom CSS settings

As an alternative, specify CSS directly in the Add CSS rules editor.

Configuring syntax highlighting

You can configure Markdown-aware syntax highlighting according to your preferences and habits.

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | Markdown.

  2. Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configuring Colors and Fonts.

Last modified: 4 April 2020