Files
Agent-n8n/web_frontend/exhibition-demo/node_modules/micromark-util-decode-string/index.js
Yep_Q 1564396449 feat: 完善会展策划演示系统
详细说明:
- 添加了V2版本的工作流页面和结果页面
- 更新了Serena记忆文件
- 添加了详细实施计划文档
- 优化了Vite配置
- 更新了项目文档CLAUDE.md
- 构建了演示系统的dist版本
- 包含了exhibition-demo的完整依赖
2025-09-08 11:15:23 +08:00

45 lines
1.2 KiB
JavaScript

import { decodeNamedCharacterReference } from 'decode-named-character-reference';
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
/**
* Decode markdown strings (which occur in places such as fenced code info
* strings, destinations, labels, and titles).
*
* The “string” content type allows character escapes and -references.
* This decodes those.
*
* @param {string} value
* Value to decode.
* @returns {string}
* Decoded value.
*/
export function decodeString(value) {
return value.replace(characterEscapeOrReference, decode);
}
/**
* @param {string} $0
* Match.
* @param {string} $1
* Character escape.
* @param {string} $2
* Character reference.
* @returns {string}
* Decoded value
*/
function decode($0, $1, $2) {
if ($1) {
// Escape.
return $1;
}
// Reference.
const head = $2.charCodeAt(0);
if (head === 35) {
const head = $2.charCodeAt(1);
const hex = head === 120 || head === 88;
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
}
return decodeNamedCharacterReference($2) || $0;
}