the editable site (validation-lab)
This commit is contained in:
commit
3ac81d5a52
13454 files changed
+2227005
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @import {Info, State} from 'mdast-util-to-markdown'
|
||||
* @import {Parents, Root} from 'mdast'
|
||||
*/
|
||||
|
||||
import {phrasing} from 'mdast-util-phrasing'
|
||||
|
||||
/**
|
||||
* Serialize a root node.
|
||||
*
|
||||
* @param {Root} node
|
||||
* Node to serialize.
|
||||
* @param {Parents | undefined} _
|
||||
* Parent node.
|
||||
* @param {State} state
|
||||
* Info passed around.
|
||||
* @param {Info} info
|
||||
* Info on surrounding context.
|
||||
* @returns {string}
|
||||
* Serialized markdown.
|
||||
*/
|
||||
export function root(node, _, state, info) {
|
||||
// Note: `html` nodes are ambiguous.
|
||||
const hasPhrasing = node.children.some(function (d) {
|
||||
return phrasing(d)
|
||||
})
|
||||
|
||||
if (!hasPhrasing) return state.containerFlow(node, info)
|
||||
|
||||
const exit = state.enter('phrasing')
|
||||
const value = state.containerPhrasing(node, info)
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
Reference in new issue
Block a user