@anyblock/remark-any-block 1.0.0-beta1 → 1.0.0-beta10

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/README.md CHANGED
@@ -30,7 +30,7 @@ $ npm publish --tag beta # 如果使用测试或beta版本 (包含 `-tagname`)
30
30
  ```
31
31
 
32
32
  > [!warning]
33
- > 补丁: 2025-12-09 开始不再能使用长期验证方式,得用 `npm login`
33
+ > 补丁: 2025-12-09 开始不再能使用长期验证方式,得每次都要 `npm login` 一下
34
34
  >
35
35
  > 否则报错:
36
36
  > ```bash
package/anyblock.ts CHANGED
@@ -1,9 +1,3 @@
1
- // import { unified } from 'unified';
2
- // import remarkParse from 'remark-parse';
3
- // import remarkRehype from 'remark-rehype';
4
- // import rehypeStringify from 'rehype-stringify';
5
-
6
- // import { remove } from "unist-util-remove"
7
1
  import { Plugin } from "unified"
8
2
  import { Root, RootContent, Paragraph, Text, Code, Html } from "mdast"
9
3
  import type { VFile } from "vfile"
@@ -187,7 +181,8 @@ export const remark_anyblock_to_codeblock: Plugin<[Partial<AnyBlockOptions>?], R
187
181
  }
188
182
 
189
183
  // 渲染 anyblock 代码块
190
- const remark_anyblock_render_codeblock = () => {
184
+ export const remark_anyblock_render_codeblock = () => {
185
+ if (typeof document == "undefined") return
191
186
  return (tree: Root, _file: VFile) => {
192
187
  visit(tree, "code", (node: Code, index: number|undefined, parent: any|undefined) => { // 遍历所有的 code 类型节点
193
188
  console.log("\nanyblock codeblock transformer visit:", node)
@@ -222,7 +217,7 @@ const remark_anyblock_render_codeblock = () => {
222
217
 
223
218
  {
224
219
  // 定义环境条件
225
- ABCSetting.env = "markdown-it"; // remark
220
+ ABCSetting.env = "remark";
226
221
 
227
222
  // 定义默认渲染行为 // [!code hl] risk 同步适配异步,可能会存在问题
228
223
  ABConvertManager.getInstance().redefine_renderMarkdown((markdown: string, el: HTMLElement):void => {