🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
48
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal file
48
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* @typedef {import('mdast').Emphasis} Emphasis
|
||||
* @typedef {import('../types.js').Parent} Parent
|
||||
* @typedef {import('../types.js').State} State
|
||||
* @typedef {import('../types.js').Info} Info
|
||||
*/
|
||||
|
||||
import {checkEmphasis} from '../util/check-emphasis.js'
|
||||
|
||||
emphasis.peek = emphasisPeek
|
||||
|
||||
// To do: there are cases where emphasis cannot “form” depending on the
|
||||
// previous or next character of sequences.
|
||||
// There’s no way around that though, except for injecting zero-width stuff.
|
||||
// Do we need to safeguard against that?
|
||||
/**
|
||||
* @param {Emphasis} node
|
||||
* @param {Parent | undefined} _
|
||||
* @param {State} state
|
||||
* @param {Info} info
|
||||
* @returns {string}
|
||||
*/
|
||||
export function emphasis(node, _, state, info) {
|
||||
const marker = checkEmphasis(state)
|
||||
const exit = state.enter('emphasis')
|
||||
const tracker = state.createTracker(info)
|
||||
let value = tracker.move(marker)
|
||||
value += tracker.move(
|
||||
state.containerPhrasing(node, {
|
||||
before: value,
|
||||
after: marker,
|
||||
...tracker.current()
|
||||
})
|
||||
)
|
||||
value += tracker.move(marker)
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Emphasis} _
|
||||
* @param {Parent | undefined} _1
|
||||
* @param {State} state
|
||||
* @returns {string}
|
||||
*/
|
||||
function emphasisPeek(_, _1, state) {
|
||||
return state.options.emphasis || '*'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue