unified

Project:syntax-tree/hast-util-heading

Package:hast-util-heading@1.0.4

  1. Dependencies:1·Dependents:2
  2. hast utility to check if a node is a heading element
  1. unist 80
  2. hast 78
  3. util 78
  4. utility 78
  5. html 61
  6. hast-util 27
  7. heading 24
  8. category 7

hast-util-heading

Build Coverage Downloads Size Sponsors Backers Chat

hast utility to check if an element is a heading.

Install

npm:

npm install hast-util-heading

Use

var heading = require('hast-util-heading')

// Given a non-heading value:
heading({
  type: 'element',
  tagName: 'a',
  properties: {href: '#alpha', title: 'Bravo'},
  children: [{type: 'text', value: 'Charlie'}]
}) // => false

// Given a heading element:
heading({
  type: 'element',
  tagName: 'h1',
  children: [{type: 'text', value: 'Delta'}]
}) // => true

API

heading(node)

Check if the given value is a heading element.

Security

hast-util-heading does not change the syntax tree so there are no openings for cross-site scripting (XSS) attacks.

Contribute

See contributing.md in syntax-tree/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer