🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

eleventy-plugin-markdown-shortcode

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eleventy-plugin-markdown-shortcode

Eleventy plugin to add a markdown shortcode

1.1.0
latest
Source
npm
Version published
Weekly downloads
57
147.83%
Maintainers
1
Weekly downloads
 
Created
Source

eleventy-plugin-markdown-shortcode

An Eleventy plugin to render markdown as a shortcode within other templating engines.

Thanks to Bryan Robinson for the Eleventy Plugin tutorial

Installation

Available on npm.

npm install eleventy-plugin-markdown-shortcode --save

Open up your Eleventy config file (probably .eleventy.js) and add the plugin:

const markdownShortcode = require("eleventy-plugin-markdown-shortcode");
module.exports = function(eleventyConfig) {
    eleventyConfig.addPlugin(markdownShortcode);
};

Usage

This plugin is a universal shortcode, so it's available in the following templating engines:

  • Liquid
  • Nunjucks
  • Handlebars
  • JavaScript

In your templates, use the following syntax to grab the contents from any markdown file in your project path:

{% markdown '/path/to/markdown.md' %}

Frontmatter

We handle (read: ignore) frontmatter with the markdown-it-front-matter plugin. You can include standard frontmatter like so:

---
title: Frontmatter test
---

## This is from the frontmatter test file

It should *not* include anything that says `title` or the frontmatter dashes.

And the plugin will skip the frontmatter, as long as it's valid

Configuration

You can also pass in markdown-it configuration like so:

eleventyConfig.addPlugin(markdownShortcode, {
    html: true,
    linkify: true,
});

Example

View a live demo

Read the live demo source code

Issues

Having problems? File an issue on GitHub

Keywords

eleventy-plugin

FAQs

Package last updated on 12 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts