11ty

Eleventy Documentation

Documentation Pages

Markdown

Template Languages:

Eleventy Short NameFile ExtensionNPM Package
md.mdmarkdown-it
Markdown files are by default pre-processed as Liquid templates. You can change this default in your configuration file (or disable it altogether). To change this for a single template and not globally, read Changing a Template’s Rendering Engine.

Markdown Options

Default Options

The only listed options here are the ones that differ from the default markdown-it options. See all markdown-it options and defaults.

Optional: Set your own library instance

Pass in your own instance of the Markdown library using the Configuration API. See all markdown-it options.

module.exports = function(eleventyConfig) {
let markdownIt = require("markdown-it");
let options = {
html: true,
breaks: true,
linkify: true
};

eleventyConfig.setLibrary("md", markdownIt(options));
};

Add your own plugins

Pass in your own markdown-it plugins using the setLibrary Configuration API method (building on the method described in “Using your own options”).

  1. Find your own markdown-it plugin on NPM
  2. npm install the plugin.
module.exports = function(eleventyConfig) {
let markdownIt = require("markdown-it");
let markdownItEmoji = require("markdown-it-emoji");
let options = {
html: true
};
let markdownLib = markdownIt(options).use(markdownItEmoji);

eleventyConfig.setLibrary("md", markdownLib);
};