site/node_modules/mdast-util-phrasing/lib/index.js

36 lines
690 B
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
/**
* @typedef {import('mdast').PhrasingContent} PhrasingContent
*/
import {convert} from 'unist-util-is'
/**
* Check if the given value is *phrasing content*.
*
* > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.
*
* @param node
* Thing to check, typically `Node`.
* @returns
* Whether `value` is phrasing content.
*/
export const phrasing =
/** @type {(node?: unknown) => node is PhrasingContent} */
(
convert([
'break',
'delete',
'emphasis',
'footnote',
'footnoteReference',
'image',
'imageReference',
'inlineCode',
'link',
'linkReference',
'strong',
'text'
])
)