Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
50
node_modules/mdast-util-to-hast/lib/handlers/code.js
generated
vendored
Normal file
50
node_modules/mdast-util-to-hast/lib/handlers/code.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @typedef {import('hast').Element} Element
|
||||
* @typedef {import('hast').Properties} Properties
|
||||
* @typedef {import('mdast').Code} Code
|
||||
* @typedef {import('../state.js').State} State
|
||||
*/
|
||||
|
||||
// Make VS Code show references to the above types.
|
||||
''
|
||||
|
||||
/**
|
||||
* Turn an mdast `code` node into hast.
|
||||
*
|
||||
* @param {State} state
|
||||
* Info passed around.
|
||||
* @param {Code} node
|
||||
* mdast node.
|
||||
* @returns {Element}
|
||||
* hast node.
|
||||
*/
|
||||
export function code(state, node) {
|
||||
const value = node.value ? node.value + '\n' : ''
|
||||
/** @type {Properties} */
|
||||
const properties = {}
|
||||
|
||||
if (node.lang) {
|
||||
properties.className = ['language-' + node.lang]
|
||||
}
|
||||
|
||||
// Create `<code>`.
|
||||
/** @type {Element} */
|
||||
let result = {
|
||||
type: 'element',
|
||||
tagName: 'code',
|
||||
properties,
|
||||
children: [{type: 'text', value}]
|
||||
}
|
||||
|
||||
if (node.meta) {
|
||||
result.data = {meta: node.meta}
|
||||
}
|
||||
|
||||
state.patch(node, result)
|
||||
result = state.applyData(node, result)
|
||||
|
||||
// Create `<pre>`.
|
||||
result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}
|
||||
state.patch(node, result)
|
||||
return result
|
||||
}
|
Reference in New Issue
Block a user