diff --git a/skills/baoyu-format-markdown/SKILL.md b/skills/baoyu-format-markdown/SKILL.md index c7aa57b..a2b6db6 100644 --- a/skills/baoyu-format-markdown/SKILL.md +++ b/skills/baoyu-format-markdown/SKILL.md @@ -13,8 +13,7 @@ Scripts in `scripts/` subdirectory. Replace `${SKILL_DIR}` with this SKILL.md's | Script | Purpose | |--------|---------| -| `scripts/main.ts` | Main entry point with CLI options | -| `scripts/cjk-emphasis.ts` | Fix CJK emphasis/bold punctuation issues | +| `scripts/main.ts` | Main entry point with CLI options (uses remark-cjk-friendly for CJK emphasis) | | `scripts/quotes.ts` | Replace ASCII quotes with fullwidth quotes | | `scripts/autocorrect.ts` | Add CJK/English spacing via autocorrect | diff --git a/skills/baoyu-format-markdown/scripts/cjk-emphasis.ts b/skills/baoyu-format-markdown/scripts/cjk-emphasis.ts deleted file mode 100644 index ebf5ad0..0000000 --- a/skills/baoyu-format-markdown/scripts/cjk-emphasis.ts +++ /dev/null @@ -1,314 +0,0 @@ -const CJK_PUNCT_COMMON = "。.,、?!:;"; -const CJK_OPENING_PUNCT = "(〔〖〘〚「『〈《【\u201C\u2018"; -const CJK_CLOSING_PUNCT = ")〕〗〙〛」』〉》】\u201D\u2019" + CJK_PUNCT_COMMON; -const CJK_SCRIPTS = - "\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}"; - -export const CJK_CLOSING_PUNCT_RE = new RegExp(`[${CJK_CLOSING_PUNCT}]`); -export const CJK_OPENING_PUNCT_RE = new RegExp(`^[${CJK_OPENING_PUNCT}]`); -export const CJK_CHAR_RE = new RegExp(`[${CJK_SCRIPTS}]`, "u"); - -const PUNCT_OR_SYMBOL_RE = /[\p{P}\p{S}]/u; -const WORD_CHAR_RE = /[\p{L}\p{N}]/u; - -const CJK_PUNCT_PAIRS: Record = { - "“": "”", - "‘": "’", - "(": ")", - "〔": "〕", - "〖": "〗", - "〘": "〙", - "〚": "〛", - "「": "」", - "『": "』", - "〈": "〉", - "《": "》", - "【": "】", -}; - -function findInlineCodeRanges(text: string): Array<[number, number]> { - const ranges: Array<[number, number]> = []; - let i = 0; - while (i < text.length) { - if (text[i] !== "`") { - i += 1; - continue; - } - - let run = 1; - while (i + run < text.length && text[i + run] === "`") { - run += 1; - } - - const start = i; - let j = i + run; - let found = false; - while (j < text.length) { - if (text[j] !== "`") { - j += 1; - continue; - } - let closeRun = 1; - while (j + closeRun < text.length && text[j + closeRun] === "`") { - closeRun += 1; - } - if (closeRun === run) { - ranges.push([start, j + closeRun - 1]); - i = j + closeRun; - found = true; - break; - } - j += closeRun; - } - - if (!found) { - i = start + run; - } - } - return ranges; -} - -function isEscaped(text: string, pos: number): boolean { - let count = 0; - for (let i = pos - 1; i >= 0 && text[i] === "\\"; i -= 1) { - count += 1; - } - return count % 2 === 1; -} - -function isWhitespaceChar(ch: string | undefined): boolean { - return !ch || /\s/u.test(ch); -} - -function isPunctuationOrSymbol(ch: string | undefined): boolean { - return !!ch && PUNCT_OR_SYMBOL_RE.test(ch); -} - -function isMatchingCjkPunct(open: string, close: string): boolean { - return CJK_PUNCT_PAIRS[open] === close; -} - -function mapNonCodeSegments( - block: string, - mapper: (segment: string) => string -): string { - const codeRanges = findInlineCodeRanges(block); - if (codeRanges.length === 0) { - return mapper(block); - } - - let result = ""; - let lastIndex = 0; - for (const [start, end] of codeRanges) { - if (start > lastIndex) { - result += mapper(block.slice(lastIndex, start)); - } - result += block.slice(start, end + 1); - lastIndex = end + 1; - } - if (lastIndex < block.length) { - result += mapper(block.slice(lastIndex)); - } - return result; -} - -function moveCjkPunctuationOutsideEmphasis(block: string): string { - return mapNonCodeSegments(block, (segment) => { - const delimiterPositions: number[] = []; - let cursor = 0; - while (cursor < segment.length - 1) { - if ( - segment[cursor] === "*" && - segment[cursor + 1] === "*" && - segment[cursor - 1] !== "*" && - segment[cursor + 2] !== "*" && - !isEscaped(segment, cursor) - ) { - delimiterPositions.push(cursor); - cursor += 2; - continue; - } - cursor += 1; - } - - if (delimiterPositions.length < 2) return segment; - - const stack: number[] = []; - const pairs: Array<{ open: number; close: number }> = []; - for (const pos of delimiterPositions) { - if (stack.length === 0) { - stack.push(pos); - } else { - const open = stack.pop() as number; - pairs.push({ open, close: pos }); - } - } - - const skip = new Set(); - const insertBefore = new Map(); - - for (const pair of pairs) { - const openPunctPos = pair.open + 2; - const closePunctPos = pair.close - 1; - if (openPunctPos >= closePunctPos) continue; - - const openPunct = segment[openPunctPos]; - const closePunct = segment[closePunctPos]; - if (!openPunct || !closePunct) continue; - if (!CJK_OPENING_PUNCT_RE.test(openPunct)) continue; - if (!CJK_CLOSING_PUNCT_RE.test(closePunct)) continue; - if (!isMatchingCjkPunct(openPunct, closePunct)) continue; - if (openPunctPos + 1 >= closePunctPos) continue; - - const inner = segment.slice(openPunctPos + 1, closePunctPos); - if (inner.length === 0) continue; - - skip.add(openPunctPos); - skip.add(closePunctPos); - - insertBefore.set(pair.open, (insertBefore.get(pair.open) ?? "") + openPunct); - const afterClose = pair.close + 2; - insertBefore.set( - afterClose, - (insertBefore.get(afterClose) ?? "") + closePunct - ); - } - - if (skip.size === 0) return segment; - - let result = ""; - for (let idx = 0; idx < segment.length; idx += 1) { - const insert = insertBefore.get(idx); - if (insert) { - result += insert; - } - if (skip.has(idx)) { - continue; - } - result += segment[idx]; - } - const tailInsert = insertBefore.get(segment.length); - if (tailInsert) { - result += tailInsert; - } - return result; - }); -} - -function fixCjkEmphasisSpacingInBlock(block: string): string { - const normalized = moveCjkPunctuationOutsideEmphasis(block); - const codeRanges = findInlineCodeRanges(normalized); - let rangeIndex = 0; - - const delimiters: Array<{ - pos: number; - canOpen: boolean; - canClose: boolean; - }> = []; - let cursor = 0; - while (cursor < normalized.length - 1) { - if (rangeIndex < codeRanges.length && cursor >= codeRanges[rangeIndex][0]) { - if (cursor <= codeRanges[rangeIndex][1]) { - cursor = codeRanges[rangeIndex][1] + 1; - continue; - } - rangeIndex += 1; - continue; - } - - if ( - normalized[cursor] === "*" && - normalized[cursor + 1] === "*" && - normalized[cursor - 1] !== "*" && - normalized[cursor + 2] !== "*" && - !isEscaped(normalized, cursor) - ) { - const before = normalized[cursor - 1]; - const after = normalized[cursor + 2]; - const beforeIsSpace = isWhitespaceChar(before); - const afterIsSpace = isWhitespaceChar(after); - const beforeIsPunct = isPunctuationOrSymbol(before); - const afterIsPunct = isPunctuationOrSymbol(after); - const leftFlanking = - !afterIsSpace && (!afterIsPunct || beforeIsSpace || beforeIsPunct); - const rightFlanking = - !beforeIsSpace && (!beforeIsPunct || afterIsSpace || afterIsPunct); - const cjkPunctBefore = !!before && CJK_CLOSING_PUNCT_RE.test(before); - const wordAfter = !!after && WORD_CHAR_RE.test(after); - - delimiters.push({ - pos: cursor, - canOpen: leftFlanking, - canClose: rightFlanking || (cjkPunctBefore && wordAfter), - }); - cursor += 2; - continue; - } - - cursor += 1; - } - - const stack: Array<{ pos: number }> = []; - const pairs: Array<{ open: number; close: number }> = []; - for (const delimiter of delimiters) { - if (delimiter.canClose) { - let openerIndex = -1; - for (let j = stack.length - 1; j >= 0; j -= 1) { - openerIndex = j; - break; - } - if (openerIndex !== -1) { - const opener = stack.splice(openerIndex, 1)[0]; - pairs.push({ open: opener.pos, close: delimiter.pos }); - } - } - if (delimiter.canOpen) { - stack.push({ pos: delimiter.pos }); - } - } - - if (pairs.length === 0) return normalized; - - const insertPositions = new Set(); - for (const pair of pairs) { - const insideLast = normalized[pair.close - 1]; - const afterClose = normalized[pair.close + 2]; - if (!afterClose) continue; - if ( - CJK_CLOSING_PUNCT_RE.test(insideLast) && - WORD_CHAR_RE.test(afterClose) - ) { - insertPositions.add(pair.close + 2); - } - } - - if (insertPositions.size === 0) return normalized; - - let result = ""; - for (let idx = 0; idx < normalized.length; idx += 1) { - if (insertPositions.has(idx)) { - result += " "; - } - result += normalized[idx]; - } - if (insertPositions.has(normalized.length)) { - result += " "; - } - return result; -} - -export function fixCjkEmphasisSpacing(content: string): string { - const parts = content.split(/(^```[\s\S]*?^```|^~~~[\s\S]*?^~~~)/m); - return parts - .map((part, i) => { - if (i % 2 === 1) return part; - const blocks = part.split(/(\n\s*\n+)/); - return blocks - .map((block, index) => { - if (index % 2 === 1) return block; - return fixCjkEmphasisSpacingInBlock(block); - }) - .join(""); - }) - .join(""); -} diff --git a/skills/baoyu-format-markdown/scripts/main.ts b/skills/baoyu-format-markdown/scripts/main.ts index 9794bc6..a1f9524 100644 --- a/skills/baoyu-format-markdown/scripts/main.ts +++ b/skills/baoyu-format-markdown/scripts/main.ts @@ -1,17 +1,12 @@ import { readFileSync, writeFileSync } from "fs"; import { unified } from "unified"; import remarkParse from "remark-parse"; +import remarkCjkFriendly from "remark-cjk-friendly"; import remarkGfm from "remark-gfm"; import remarkFrontmatter from "remark-frontmatter"; import remarkStringify from "remark-stringify"; import { visit } from "unist-util-visit"; import YAML from "yaml"; -import { - fixCjkEmphasisSpacing, - CJK_CLOSING_PUNCT_RE, - CJK_OPENING_PUNCT_RE, - CJK_CHAR_RE, -} from "./cjk-emphasis"; import { replaceQuotes } from "./quotes"; import { applyAutocorrect } from "./autocorrect"; @@ -36,6 +31,12 @@ const DEFAULT_OPTIONS: Required = { emphasis: true, }; +function decodeHtmlEntities(text: string): string { + return text.replace(/&#x([0-9A-Fa-f]+);/g, (_, hex) => + String.fromCodePoint(parseInt(hex, 16)) + ); +} + function formatFrontmatter(value: string): string | null { try { const doc = YAML.parseDocument(value); @@ -49,12 +50,9 @@ function formatMarkdownContent( content: string, options: Required ): string { - if (options.emphasis) { - content = fixCjkEmphasisSpacing(content); - } - const processor = unified() .use(remarkParse) + .use(options.emphasis ? remarkCjkFriendly : []) .use(remarkGfm) .use(remarkFrontmatter, ["yaml"]) .use(remarkStringify, { @@ -63,7 +61,7 @@ function formatMarkdownContent( const tree = processor.parse(content); - visit(tree, (node, _index, parent) => { + visit(tree, (node) => { if (node.type === "text" && options.quotes) { const textNode = node as { value: string }; textNode.value = replaceQuotes(textNode.value); @@ -77,54 +75,11 @@ function formatMarkdownContent( } return; } - if ( - options.emphasis && - (node.type === "strong" || - node.type === "emphasis" || - node.type === "delete") && - parent - ) { - const siblings = (parent as { children: typeof node[] }).children; - const idx = siblings.indexOf(node); - const children = (node as { children: typeof node[] }).children; - if (!children || children.length === 0) return; - - const lastChild = children[children.length - 1]; - if (lastChild.type === "text") { - const lastText = (lastChild as { value: string }).value; - if ( - CJK_CLOSING_PUNCT_RE.test(lastText.slice(-1)) && - idx + 1 < siblings.length - ) { - const nextSib = siblings[idx + 1]; - if (nextSib.type === "text") { - const nextText = (nextSib as { value: string }).value; - if (CJK_CHAR_RE.test(nextText.charAt(0))) { - (nextSib as { value: string }).value = " " + nextText; - } - } - } - } - - const firstChild = children[0]; - if (firstChild.type === "text") { - const firstText = (firstChild as { value: string }).value; - if (CJK_OPENING_PUNCT_RE.test(firstText) && idx > 0) { - const prevSib = siblings[idx - 1]; - if (prevSib.type === "text") { - const prevText = (prevSib as { value: string }).value; - if (CJK_CHAR_RE.test(prevText.charAt(prevText.length - 1))) { - (prevSib as { value: string }).value = prevText + " "; - } - } - } - } - } }); let result = processor.stringify(tree); if (options.emphasis) { - result = fixCjkEmphasisSpacing(result); + result = decodeHtmlEntities(result); } return result; } diff --git a/skills/baoyu-format-markdown/scripts/package-lock.json b/skills/baoyu-format-markdown/scripts/package-lock.json new file mode 100644 index 0000000..90a69d6 --- /dev/null +++ b/skills/baoyu-format-markdown/scripts/package-lock.json @@ -0,0 +1,1125 @@ +{ + "name": "scripts", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "remark-cjk-friendly": "^1.1.0", + "remark-frontmatter": "^5.0.0", + "remark-gfm": "^4.0.1", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.5", + "unist-util-visit": "^5.1.0", + "yaml": "^2.8.2" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "license": "MIT" + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "license": "MIT" + }, + "node_modules/bail": { + "version": "2.0.2", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "license": "MIT" + }, + "node_modules/fault": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/format": { + "version": "0.2.2", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "escape-string-regexp": "^5.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-cjk-friendly": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/micromark-extension-cjk-friendly/-/micromark-extension-cjk-friendly-1.2.3.tgz", + "integrity": "sha512-gRzVLUdjXBLX6zNPSnHGDoo+ZTp5zy+MZm0g3sv+3chPXY7l9gW+DnrcHcZh/jiPR6MjPKO4AEJNp4Aw6V9z5Q==", + "license": "MIT", + "dependencies": { + "devlop": "^1.1.0", + "micromark-extension-cjk-friendly-util": "2.1.1", + "micromark-util-chunked": "^2.0.1", + "micromark-util-resolve-all": "^2.0.1", + "micromark-util-symbol": "^2.0.1" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "micromark": "^4.0.0", + "micromark-util-types": "^2.0.0" + }, + "peerDependenciesMeta": { + "micromark-util-types": { + "optional": true + } + } + }, + "node_modules/micromark-extension-cjk-friendly-util": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-cjk-friendly-util/-/micromark-extension-cjk-friendly-util-2.1.1.tgz", + "integrity": "sha512-egs6+12JU2yutskHY55FyR48ZiEcFOJFyk9rsiyIhcJ6IvWB6ABBqVrBw8IobqJTDZ/wdSr9eoXDPb5S2nW1bg==", + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.0", + "micromark-util-character": "^2.1.1", + "micromark-util-symbol": "^2.0.1" + }, + "engines": { + "node": ">=16" + }, + "peerDependenciesMeta": { + "micromark-util-types": { + "optional": true + } + } + }, + "node_modules/micromark-extension-frontmatter": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "fault": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/remark-cjk-friendly": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/remark-cjk-friendly/-/remark-cjk-friendly-1.2.3.tgz", + "integrity": "sha512-UvAgxwlNk+l9Oqgl/9MWK2eWRS7zgBW/nXX9AthV7nd/3lNejF138E7Xbmk9Zs4WjTJGs721r7fAEc7tNFoH7g==", + "license": "MIT", + "dependencies": { + "micromark-extension-cjk-friendly": "1.2.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@types/mdast": "^4.0.0", + "unified": "^11.0.0" + }, + "peerDependenciesMeta": { + "@types/mdast": { + "optional": true + } + } + }, + "node_modules/remark-frontmatter": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-frontmatter": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "11.0.5", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.1.0", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/yaml": { + "version": "2.8.2", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/skills/baoyu-format-markdown/scripts/package.json b/skills/baoyu-format-markdown/scripts/package.json index 3841a0b..cfa5223 100644 --- a/skills/baoyu-format-markdown/scripts/package.json +++ b/skills/baoyu-format-markdown/scripts/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "remark-cjk-friendly": "^1.1.0", "remark-frontmatter": "^5.0.0", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0",