mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 18:39:31 +08:00
23 lines
686 B
Text
23 lines
686 B
Text
/**
|
|
* @typedef {import('micromark-util-types').Construct} Construct
|
|
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
|
* @typedef {import('micromark-util-types').State} State
|
|
*/
|
|
import {factorySpace} from 'micromark-factory-space'
|
|
import {markdownLineEnding} from 'micromark-util-character'
|
|
|
|
/** @type {Construct} */
|
|
export const blankLine = {
|
|
tokenize: tokenizeBlankLine,
|
|
partial: true
|
|
}
|
|
/** @type {Tokenizer} */
|
|
|
|
function tokenizeBlankLine(effects, ok, nok) {
|
|
return factorySpace(effects, afterWhitespace, 'linePrefix')
|
|
/** @type {State} */
|
|
|
|
function afterWhitespace(code) {
|
|
return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
|
|
}
|
|
}
|