mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 17:35:28 +00:00
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