Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Preview

There are two ways to see the open file as a MyST page:

Switch between them, or to plain Source, with the buttons in the toolbar.

Live preview

With Live on, each block (a paragraph, heading, directive, or equation) shows rendered, and the block with the cursor shows its Markdown. To edit a block, click it or move into it with the arrow keys. The cursor lands on the text you clicked.

Live preview works in the web editor, JupyterLab, and VS Code. In JupyterLab it also covers notebooks’ Markdown cells while you edit them. JupyterLab says when the cells you aren’t editing show the build. In JupyterLab, turn it on or off with MyST: Live Preview in the Command Palette. In VS Code, switch a Markdown file between the text editor and the live editor with MyST: Toggle Live Editor.

Fast and built previews

There are two versions of the preview, shown in the same pane:

The editor shows the built preview whenever mystmd’s latest build matches the text in the editor, and the fast preview otherwise. In the fast preview, blocks you haven’t touched since the last build keep showing the built version. The badge in the toolbar tells you which one you’re looking at:

BadgeMeaning
fast preview · unsavedThe file has unsaved changes, and mystmd only builds saved files.
fast previewmystmd hasn’t built this file yet, or doesn’t build it.
building…Your changes are saved and mystmd is rebuilding.
built ✓You’re looking at mystmd’s build of exactly this text.
no mystmdmystmd isn’t installed, so only the fast preview is available.

Code cells and {eval}

The web editor and JupyterLab have mystmd run code cells and inline {eval} expressions as it builds, so the built preview shows their results and outputs. In VS Code it’s off unless you turn on the MyST Language Server extension’s mystmdLsp.execute setting, since that extension starts mystmd. Running code needs Jupyter. Without Jupyter, pages still build and notebooks keep their saved outputs. mystmd runs a page again each time you save a change to its code.

To turn it off in the web editor, run npm start -- --no-execute path/to/project. In JupyterLab, set MYST_AUTHOR_EXECUTE=0 before you start Jupyter.

Outputs look like they do on a mystmd site. HTML output, such as a pandas table, shows too. HTML with scripts, such as a plotly plot, shows its plain text instead, because scripts there could read your files.

mystmd’s logs

mystmd’s build output, including its warnings, shows up as [myst] lines:

Click to jump to the source

Click a paragraph, heading, or other block in the preview and the editor moves to its first line. Clicking tabs, dropdowns, or buttons in the preview doesn’t move the editor, and neither does selecting text. A click on a link follows it.

Scroll sync

Scrolling the editor scrolls the preview to the matching block. It works in one direction only: scrolling the preview doesn’t move the editor.