mdast-utils

1.0.0 • Public • Published

mdast-utils npm version

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 :)

License

MITDarkhax

Readme

Keywords

Package Sidebar

Install

npm i mdast-utils

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

49.4 kB

Total Files

12

Last publish

Collaborators

  • darkhax