forked from abner/for-legacy-web
feat: convert html AST nodes to text
This commit is contained in:
10
src/components/markdown/plugins/htmlToText.ts
Normal file
10
src/components/markdown/plugins/htmlToText.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Plugin } from "unified";
|
||||
import { visit } from "unist-util-visit";
|
||||
|
||||
export const remarkHtmlToText: Plugin = () => {
|
||||
return (tree) => {
|
||||
visit(tree, "html", (node: { type: string; value: string }) => {
|
||||
node.type = "text";
|
||||
});
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user