feat: use go tool

This commit is contained in:
2026-07-03 19:24:01 -04:00
parent 39548b4332
commit 4d0cab1fe0
1542 changed files with 252399 additions and 14 deletions
+59
View File
@@ -0,0 +1,59 @@
/**
* @import {Code, Effects, State, TokenizeContext, TokenType} from 'micromark-util-types'
*/
import {
markdownLineEnding,
unicodePunctuation,
unicodeWhitespace
} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol'
/**
* @this {TokenizeContext}
* @param {Effects} effects
* @param {State} ok
* @param {State} nok
* @param {TokenType} type
*/
export function factoryName(effects, ok, nok, type) {
const self = this
return start
/** @type {State} */
function start(code) {
if (
code === codes.eof ||
markdownLineEnding(code) ||
unicodePunctuation(code) ||
unicodeWhitespace(code)
) {
return nok(code)
}
effects.enter(type)
effects.consume(code)
return name
}
/** @type {State} */
function name(code) {
if (
code === codes.eof ||
markdownLineEnding(code) ||
unicodeWhitespace(code) ||
(unicodePunctuation(code) &&
code !== codes.dash &&
code !== codes.underscore)
) {
effects.exit(type)
return self.previous === codes.dash || self.previous === codes.underscore
? nok(code)
: ok(code)
}
effects.consume(code)
return name
}
}