mdast-utils
v1.0.0
Published
An unofficial collection of helper methods for working with MdAST nodes.
Downloads
9
Readme
mdast-utils 
A set of helper methods for working with MdAST nodes.
Installation
npm install mdast-utils
Usage
Import the desired functions from mdast-utils
. You can then use this function to help build your nodes. Here is an example which creates a clickable image link.
import {imageNodeRaw, linkNodeRaw} from 'mdast-utils';
const ghImage = imageNodeRaw("an-image", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png", "GitHub Logo", "A white Silhouette of a cat with tentacles against a black circular background.");
const ghImageLink = linkNodeRaw("github-image-link", "https://github.com", "The GitHub home page.", ghImage);
which yields
{
type: 'link',
url: 'https://github.com',
title: 'The GitHub home page.',
children: [
{
type: 'image',
url: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png',
title: 'GitHub Logo',
alt: 'A white Silhouette of a cat with tentacles against a black circular background.'
}
]
}
Used By
Nobody quite yet :)