diff --git a/src/lib/markdown/parser.ts b/src/lib/markdown/parser.ts
index ff85f8b..1f93a5f 100644
--- a/src/lib/markdown/parser.ts
+++ b/src/lib/markdown/parser.ts
@@ -58,13 +58,6 @@ export class MarkdownParser {
return token as any
}
return undefined
- },
- renderer(token: any) {
- const footnoteStyle = (options?.inline?.footnote || {})
- const styleStr = Object.entries(footnoteStyle)
- .map(([key, value]) => `${key}:${value}`)
- .join(';')
- return `[${token.text}]`
}
}]
})
diff --git a/src/lib/markdown/renderer.ts b/src/lib/markdown/renderer.ts
index e03c54b..50d075a 100644
--- a/src/lib/markdown/renderer.ts
+++ b/src/lib/markdown/renderer.ts
@@ -370,6 +370,13 @@ export class MarkdownRenderer {
const styleStr = cssPropertiesToString(delStyle)
return `${text}`
}
+
+ // 添加脚注支持
+ this.renderer.footnote = (token: any) => {
+ const footnoteStyle = (this.options.inline?.footnote || {})
+ const styleStr = cssPropertiesToString(footnoteStyle)
+ return `[${token.text}]`
+ }
}
public getRenderer(): typeof marked.Renderer.prototype {
diff --git a/src/types/marked.d.ts b/src/types/marked.d.ts
new file mode 100644
index 0000000..74b0cf5
--- /dev/null
+++ b/src/types/marked.d.ts
@@ -0,0 +1,7 @@
+import { marked } from 'marked';
+
+declare module 'marked' {
+ interface RendererThis {
+ footnote: (token: any) => string;
+ }
+}