unified

Project: syntax-tree/hast-util-phrasing

Package: hast-util-phrasing@1.0.5

  1. Dependencies: 4·Dependents: 3
  2. hast utility to check if a node is phrasing content
  1. util 118
  2. utility 114
  3. unist 110
  4. html 110
  5. hast 60
  6. hast-util 40
  7. category 7
  8. phrasing 2

hast-util-phrasing

Build Coverage Downloads Size Sponsors Backers Chat

hast utility to check if a node is phrasing content.

Install

npm:

npm install hast-util-phrasing

Use

var phrasing = require('.')

// Given flow content:
phrasing({
  type: 'element',
  tagName: 'div',
  children: [{type: 'text', value: 'Alpha'}]
})
// => false

// Given a phrasing element:
phrasing({
  type: 'element',
  tagName: 'meta',
  properties: {itemProp: 'bravo'},
  children: []
})
// => true

// Given a non-phrasing element:
phrasing({
  type: 'element',
  tagName: 'meta',
  properties: {charSet: 'utf8'},
  children: []
})
// => false

// Given text:
phrasing({type: 'text', value: 'Delta'})
// => true

API

phrasing(node)

Check if the given value is phrasing content.

Parameters
Returns

boolean — Whether node passes the test.

Security

hast-util-phrasing 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