diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 404296f..b1f3ed9 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -4,6 +4,7 @@ const unified = require("unified"); const stringify = require('rehype-stringify') const rehypeRaw = require('rehype-raw') const remarkParse = require('remark-parse') +const gfm = require('remark-gfm') const remark2rehype = require('remark-rehype') const rehypeAttrs = require('../lib') @@ -148,6 +149,27 @@ describe('rehype-attr test case', () => { .toString() expect(htmlStr).toEqual(data.expected); }); + }); + + [ + { + title: 'options="attr" - Delete `~~Text~~`', + markdown: 'This is a ~~title~~', + expected: '

This is a title

', + } + ].forEach((data, idx) => { + it(data.title, async () => { + const htmlStr = unified() + .use(remarkParse) + .use(gfm) + .use(remark2rehype, { allowDangerousHtml: true }) + .use(rehypeRaw) + .use(rehypeAttrs, { properties: 'attr' }) + .use(stringify) + .processSync(data.markdown) + .toString() + expect(htmlStr).toEqual(data.expected); + }); }) }); diff --git a/package.json b/package.json index 1b6886b..6234dee 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "rehype": "11.0.0", "rehype-raw": "5.1.0", "rehype-stringify": "8.0.0", + "remark-gfm": "^1.0.0", "remark-parse": "9.0.0", "remark-rehype": "8.1.0", "tsbb": "2.1.2"