Skip to content

humanwhocodes/markdown-it-markua-aside

Repository files navigation

Markua Aside Plugin for markdown-it

by Nicholas C. Zakas

If you find this useful, please consider supporting my work with a donation.

Description

A markdown-it plugin to support Markua-style asides and blurbs, such as:

{aside}Something said to the side.{/aside}

{blurb}Something else you should know.{/blurb}

{blurb, class: warning}
Don't do this!
{/blurb}

A> Something said to the site.

B> Something else you should know.

Prerequisites

  • Node.js 12.22+

Usage

Install using npm or yarn:

npm install @humanwhocodes/markdown-it-markua-aside --save

# or

yarn add @humanwhocodes/markdown-it-markua-aside

Import into your project:

// CommonJS
const { asidePlugin } = require("@humanwhocodes/markdown-it-markua-aside");

// ESM
import { asidePlugin } from "@humanwhocodes/markdown-it-markua-aside";

API

After importing, create a new instance of DataExtractor. The constructor expects one object argument that defines the data schema.

For example:

import MarkdownIt from "markdown-it";
import { asidePlugin } from "@humanwhocodes/markdown-it-markua-aside";

// create a new instance
const md = new MarkdownIt();

// install the plugin
md.use(asidePlugin);

// render your text
const result = md.render("{aside}Hello world!{/aside}");

Developer Setup

  1. Fork the repository
  2. Clone your fork
  3. Run npm install to setup dependencies
  4. Run npm test to run tests

License

Apache 2.0