Adding additional plugins

YFM uses markdown-it as a parser, so you can add any plugin from the markdown-it plugin list.

Adding plugins

Before adding a plugin, install the package that contains it using the npm i <plug_name> command. For example, to install markdown-it-emoji, run:

npm i markdown-it-emoji
  1. Add the plugin in your code using the require() or import() function:

    const plugin1 = require('<plug_name>');
  2. For the plugins parameter, add a new plugin to the array:

    const {result: {html, meta}, logs} = transform(content, {plugins: [<plug_name>]});


const fs = require('fs');
const transform = require('@doc-tools/transform');
const cut = require('@doc-tools/transform/lib/plugins/cut');
const sup = require('@doc-tools/transform/lib/plugins/sup');
const emoji = require('markdown-it-emoji');
const content = fs.readFileSync(filePath, 'utf');
const {result: {html, meta}, logs} = transform(content, {plugins: [cut, sup, emoji]});


When overriding the plugins parameter, you must reconnect YFM plugins. To do this, import them from the @doc-tools/transform package and pass them in the plugin array.

  1. Move the installed plugin to the ./plugins folder in the @doc-tools/docs package.


If you don't want to transfer the necessary plugins before each build, build your own Builder:

  • Install the source code with GitHub.
  • Move the additional plugins to the ./plugins folder.
  • Build the Builder by following the GitHub instructions.

Passing parameters

YFM applies unknown parameters from the options object to all plugins, so to pass parameters, add them to the options object.