hast utility to get the rank (or depth, level) of headings.
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
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.