🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
29
node_modules/mdast-util-to-hast/lib/handlers/html.js
generated
vendored
Normal file
29
node_modules/mdast-util-to-hast/lib/handlers/html.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @typedef {import('hast').Element} Element
|
||||
* @typedef {import('mdast').HTML} Html
|
||||
* @typedef {import('../state.js').State} State
|
||||
* @typedef {import('../../index.js').Raw} Raw
|
||||
*/
|
||||
|
||||
/**
|
||||
* Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
|
||||
* nothing).
|
||||
*
|
||||
* @param {State} state
|
||||
* Info passed around.
|
||||
* @param {Html} node
|
||||
* mdast node.
|
||||
* @returns {Raw | Element | null}
|
||||
* hast node.
|
||||
*/
|
||||
export function html(state, node) {
|
||||
if (state.dangerous) {
|
||||
/** @type {Raw} */
|
||||
const result = {type: 'raw', value: node.value}
|
||||
state.patch(node, result)
|
||||
return state.applyData(node, result)
|
||||
}
|
||||
|
||||
// To do: next major: return `undefined`.
|
||||
return null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue