hast utility to get the rank (or depth, level) of headings.
This package is ESM only:
Node 12+ is needed to use it and it must be
imported instead of
npm install hast-util-heading-rank
var h = require('hastscript') var rank = require('hast-util-heading-rank') rank(h('p', 'Alpha')) //=> null rank(h('h5', 'Alpha')) //=> 5
This package exports the following identifiers:
There is no default export.
Get the rank (
6) of headings (
Node) — Node to check
number?) — Rank of the heading, or
null if not a heading.
hast-util-heading-rank does not mutate.
There are no openings for cross-site scripting (XSS) attacks.
hast-util-heading— check if a node is a heading element
hast-util-shift-heading— utility to change heading rank
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.