JSPM

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

Utility to get the style of an mdast 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 Chat

Get the style of an MDAST heading.

Installation

npm:

npm install mdast-util-heading-style

Usage

var style = require('mdast-util-heading-style')
var remark = require('remark')()

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

style(remark.parse('### ATX').children[0]) // => null
style(remark.parse('### ATX').children[0], 'setext') // => 'setext'

API

style(node[, relative])

Get the heading style of a node.

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

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

Contribute

See contributing.md in syntax-tree/mdast for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer