@anyblock/remark-any-block 1.0.0-beta11 → 1.0.0-beta13
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/anyblock.ts +7 -4
- package/dist/remark-any-block.cjs +1017 -2559
- package/dist/remark-any-block.js +1017 -2559
- package/index.ts +1 -1
- package/package.json +1 -1
package/anyblock.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Plugin } from "unified"
|
|
2
2
|
import { Root, RootContent, Paragraph, Text, Code, Html } from "mdast"
|
|
3
3
|
import type { VFile } from "vfile"
|
|
4
|
-
import { toMarkdown } from "mdast-util-to-markdown"
|
|
5
4
|
import { visit } from "unist-util-visit"
|
|
5
|
+
import { toMarkdown } from "mdast-util-to-markdown" // TODO 这里好像会有 document 依赖
|
|
6
|
+
// 而且不一定能反序列化成功 (有私有节点类型,甚至table类型都不能识别)
|
|
7
|
+
// 后期需要去除此 "修改树" 的 `transformer` / `mdast-util` 插件
|
|
8
|
+
// 修改成 `micromarkExtensions` 形式的插件
|
|
6
9
|
|
|
7
10
|
// 这里不想去依赖 Quartz 项目,所以用any。但是你可以去看具体的类型定义
|
|
8
11
|
// import { type QuartzTransformerPlugin } from "../types"
|
|
@@ -126,8 +129,8 @@ export const remark_anyblock_to_codeblock: Plugin<[Partial<AnyBlockOptions>?], R
|
|
|
126
129
|
node_next.type === "list" ||
|
|
127
130
|
node_next.type === "heading" ||
|
|
128
131
|
node_next.type === "code" ||
|
|
129
|
-
node_next.type === "blockquote"
|
|
130
|
-
node_next.type === "table"
|
|
132
|
+
node_next.type === "blockquote"
|
|
133
|
+
// node_next.type === "table"
|
|
131
134
|
) {
|
|
132
135
|
const codeValue = `[${header}]\n${nodesToMarkdown([node_next])}`;
|
|
133
136
|
out.push({
|
|
@@ -233,7 +236,7 @@ export const transformer_anyblock: QuartzTransformerPlugin = (/*options: any*/)
|
|
|
233
236
|
name: "AnyBlock",
|
|
234
237
|
markdownPlugins(_ctx: BuildCtx) {
|
|
235
238
|
return [
|
|
236
|
-
remark_anyblock_to_codeblock,
|
|
239
|
+
// remark_anyblock_to_codeblock, // 取消注释则用库的地方会报错找不到 document
|
|
237
240
|
remark_anyblock_render_codeblock, // last
|
|
238
241
|
]
|
|
239
242
|
},
|