JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 167365
  • Score
    100M100P100Q193750F
  • License MIT

Utility to get the style of a heading

Package Exports

  • mdast-util-heading-style

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-util-heading-style) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mdast-util-heading-style Build Status Coverage Status

mdast utility to get the style of a heading.

Installation

npm:

npm install mdast-util-heading-style

mdast-util-heading-style is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var mdast = require('mdast');
var style = require('mdast-util-visit');

style(mdast.parse('# ATX').children[0]); // 'atx'
style(mdast.parse('# ATX #\n').children[0]); // 'atx-closed'
style(mdast.parse('ATX\n===').children[0]); // 'setext'

style(mdast.parse('### ATX').children[0]); // null
style(mdast.parse('### ATX').children[0], 'setext'); // 'atx'

API

style(node[, relative])

Get the heading style of a node.

Parameters:

  • node (Node) — mdast node;

  • relative (string, optional) — Style to use for ambiguous headings (atx-headings with a level of three or more could also be setext).

Return: string ("atx", "atx-closed", or "setext"). When an ambiguous heading is found, either relative or null is returned.

License

MIT © Titus Wormer