luogu-renderer 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luogu-renderer",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "Luogu Markdown renderer - old (markdown-it) and new (remark+rehype)",
5
5
  "type": "module",
6
6
  "exports": {
package/render-new.js CHANGED
@@ -12,13 +12,11 @@ import { visit } from 'unist-util-visit';
12
12
  import { toText } from 'hast-util-to-text';
13
13
  import katex from 'katex';
14
14
  import { h } from 'hastscript';
15
- import { createRequire } from 'module';
16
- const require = createRequire(import.meta.url);
17
- // Load Prism and make globally accessible so CJS components can find it
18
- globalThis.Prism = require('prismjs');
19
- require('prismjs/components/prism-clike.js');
20
- require('prismjs/components/prism-c.js');
21
- require('prismjs/components/prism-cpp.js');
15
+ import Prism from 'prismjs';
16
+ import 'prismjs/components/prism-clike.js';
17
+ import 'prismjs/components/prism-c.js';
18
+ import 'prismjs/components/prism-cpp.js';
19
+ globalThis.Prism = Prism;
22
20
 
23
21
  // ========== 1. 表格合并(处理 ^ 符号,生成 rowspan)==========
24
22
  // 在 rehype 阶段直接扫描表格,^ 向上合并并添加 rowspan
@@ -411,8 +409,8 @@ const processor = unified()
411
409
  .use(remarkEpigraph) // epigraph 容器
412
410
  .use(remarkCodeBlockParams) // 代码块参数
413
411
  .use(remarkRehype, { allowDangerousHtml: true })
414
- .use(rehypePrism)
415
412
  .use(rehypeKatexWithError) // KaTeX 渲染,错误显示红色
413
+ .use(rehypePrism)
416
414
  .use(rehypeCuteTableCleanup) // cute-table 包裹 table
417
415
  .use(rehypeTableMerge) // 在 HTML 层面清理合并单元格
418
416
  .use(rehypeAlignCleanup) // 对齐样式转移