Skip to article content
MyST Transforms


The convention used for all myst-transforms is to modify the tree in place and export two functions for transforms and plugins the plugins are unifiedjs plugins that can be chained together, for example, unified().use(myPlugin, opts).use(myOtherPlugin). These plugins are generally very light wrappers around transforms which are the funcitonal analogues of the plugin. The transforms are called on a tree, for example, myTransform(tree, opts).

In all cases transformations are completed in place on the AST.

Error ReportingΒΆ

The package uses vfile error reporting messages, this allows you to collect

import { VFile } from 'vfile';

const file = new VFile();

  .use(mathPlugin, { macros: {} }) // Add the plugin with any options
  .run(tree, file); // Run the AST through the set of plugins

// Check for errors in the messages:

You can also use vfile-reporter to pretty print the messages for the console.

import { fileWarn } from 'myst-common';

fileWarn(file, 'Replacing \\begin{eqnarray} with \\begin{align*}', {
  note: 'Although the standard eqnarray environment is available in LaTeX, ...',
  source: 'myst-transforms:math', // colon separated
  url: '',
MyST MarkdownMyST Markdown
Community-driven tools for the future of technical communication and publication