Files
NapCatQQ/.pnpm-store/v3/files/6a/a56ab95004acf7dd553a0b9f42a9e658c48b17a3ce31760df2496ac6ad074bb79f25a91bfe15a440211b11232c3a07f878fd6cf38c2eda937d970ff8e530a8
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

52 lines
1.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @typedef {import('micromark-util-types').CompileContext} CompileContext
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
* @typedef {import('micromark-util-types').Token} Token
*/
// An opening or closing tag start, followed by a case-insensitive specific tag name,
// followed by HTML whitespace, a greater than, or a slash.
const reFlow =
/<(\/?)(iframe|noembed|noframes|plaintext|script|style|title|textarea|xmp)(?=[\t\n\f\r />])/gi
// As HTML (text) parses tags separately (and very strictly), we don’t need to be
// global.
const reText = new RegExp('^' + reFlow.source, 'i')
/**
* Create an HTML extension for `micromark` to support GitHubs weird and
* useless tagfilter when serializing to HTML.
*
* @returns {HtmlExtension}
* Extension for `micromark` that can be passed in `htmlExtensions` to support
* GitHubs weird and useless tagfilter when serializing to HTML.
*/
export function gfmTagfilterHtml() {
return {
exit: {
htmlFlowData(token) {
exitHtmlData.call(this, token, reFlow)
},
htmlTextData(token) {
exitHtmlData.call(this, token, reText)
}
}
}
}
/**
* @this {CompileContext}
* @param {Token} token
* @param {RegExp} filter
* @returns {undefined}
*/
function exitHtmlData(token, filter) {
let value = this.sliceSerialize(token)
if (this.options.allowDangerousHtml) {
value = value.replace(filter, '&lt;$1$2')
}
this.raw(this.encode(value))
}