Skip to content

A remark plugin to handle inserted markdown and create mark HTML elements

License

Notifications You must be signed in to change notification settings

jmdfm/remark-inserted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remark-inserted

This plugin parses custom Markdown syntax to handle text insertions like ++cats are awesome++. It adds a new node type to the mdast produced by remark: Mark

If you are using rehype, the stringified HTML result will be <mark>.

Syntax

It's cool how ++cats++ are super awesome.

AST (see mdast specification)

Mark (Parent) represents a reference to a user.

interface Mark <: Parent {
  type: "Mark";
}

For example, the following markdown:

++cats++

Yields:

{
  type: 'mark',
  children: [{
    type: 'text',
    value: 'cats'
  }]
}

Rehype

This plugin is compatible with rehype. Mark mdast nodes will become <mark>contents</mark>.

Installation

npm:

npm install remark-inserted

Usage

Dependencies:

const unified = require("unified");
const remarkParse = require("remark-parse");
const stringify = require("rehype-stringify");
const remark2rehype = require("remark-rehype");

const remarkInserted = require("remark-inserted");

Usage:

unified()
  .use(remarkParse)
  .use(remarkInserted)
  .use(remark2rehype)
  .use(stringify);

License

MIT © John McDowall

About

A remark plugin to handle inserted markdown and create mark HTML elements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published