🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
63
node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js
generated
vendored
Normal file
63
node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Construct} Construct
|
||||
* @typedef {import('micromark-util-types').State} State
|
||||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
||||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
||||
*/
|
||||
|
||||
import {markdownLineEnding} from 'micromark-util-character'
|
||||
import {codes} from 'micromark-util-symbol/codes.js'
|
||||
import {types} from 'micromark-util-symbol/types.js'
|
||||
import {ok as assert} from 'uvu/assert'
|
||||
|
||||
/** @type {Construct} */
|
||||
export const hardBreakEscape = {
|
||||
name: 'hardBreakEscape',
|
||||
tokenize: tokenizeHardBreakEscape
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {TokenizeContext}
|
||||
* @type {Tokenizer}
|
||||
*/
|
||||
function tokenizeHardBreakEscape(effects, ok, nok) {
|
||||
return start
|
||||
|
||||
/**
|
||||
* Start of a hard break (escape).
|
||||
*
|
||||
* ```markdown
|
||||
* > | a\
|
||||
* ^
|
||||
* | b
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function start(code) {
|
||||
assert(code === codes.backslash, 'expected `\\`')
|
||||
effects.enter(types.hardBreakEscape)
|
||||
effects.consume(code)
|
||||
return after
|
||||
}
|
||||
|
||||
/**
|
||||
* After `\`, at eol.
|
||||
*
|
||||
* ```markdown
|
||||
* > | a\
|
||||
* ^
|
||||
* | b
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function after(code) {
|
||||
if (markdownLineEnding(code)) {
|
||||
effects.exit(types.hardBreakEscape)
|
||||
return ok(code)
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue