unified

Project: syntax-tree/mdast-util-phrasing

Package: mdast-util-phrasing@3.0.0

  1. Dependencies: 2·Dependents: 3
  2. mdast utility to check if a node is phrasing content
  1. markdown 142
  2. util 128
  3. utility 124
  4. unist 120
  5. mdast 89
  6. phrasing 2

mdast-util-phrasing

Build Coverage Downloads Size Sponsors Backers Chat

Check if a mdast node is phrasing content.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install mdast-util-phrasing

Use

import {phrasing} from 'mdast-util-phrasing'

phrasing({
  type: 'paragraph',
  children: [{type: 'text', value: 'Alpha'}]
}) // => false

phrasing({
  type: 'strong',
  children: [{type: 'text', value: 'Delta'}]
}) // => true

API

This package exports the following identifiers: phrasing. There is no default export.

phrasing(node)

Check if the given value is a phrasing element.

Parameters

node (*) — Value to check, typically a node.

Returns

boolean — whether node is phrasing content.

Security

Use of mdast-util-phrasing does not involve hast, user content, or change the 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 © Victor Felder