remark-docx
Version:
remark plugin to compile markdown to docx (Microsoft Word, Office Open XML).
1 lines • 1.08 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/plugins/html/index.ts"],"sourcesContent":["import type { RemarkDocxPlugin } from \"../../types\";\nimport { fromHtml } from \"hast-util-from-html\";\nimport { toMdast } from \"hast-util-to-mdast\";\nimport type { Root } from \"mdast\";\n\n/**\n * A plugin to render \"html\" node.\n */\nexport const htmlPlugin = (): RemarkDocxPlugin => {\n return async () => {\n return {\n html: ({ value }, ctx) => {\n const hast = fromHtml(value, { fragment: true });\n const mdast = toMdast(hast, {\n nodeHandlers: {\n comment: () => {\n // Ignore comment node to avoid \"RangeError: Maximum call stack size exceeded\"\n },\n },\n });\n return ctx.render((mdast as Root).children);\n },\n };\n };\n};\n"],"mappings":"wIAQA,IAAa,MACJ,UACE,CACL,MAAO,CAAE,SAAS,IAAQ,CAExB,IAAM,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,UADgB,EAAO,CAAE,SAAU,EAAK,CACxB,EAAM,CAC1B,aAAc,CACZ,YAAe,CAEf,CACF,CACF,CAAC,EACD,OAAO,EAAI,OAAQ,EAAe,QAAQ,CAC5C,CACF"}