diff --git a/__tests__/unit/node/markdown/markdown.test.ts b/__tests__/unit/node/markdown/markdown.test.ts index 0c8e554d5..d46c5aadf 100644 --- a/__tests__/unit/node/markdown/markdown.test.ts +++ b/__tests__/unit/node/markdown/markdown.test.ts @@ -114,6 +114,31 @@ describe('node/markdown/markdown', () => { }) }) + describe('attrs', () => { + test('does not consume fence info', async () => { + // line-highlight / meta syntax must reach the highlighter untouched + const meta = await render('```js{4}\nconst a = 1\n```') + expect(meta).toContain('language-js') + expect(meta).not.toContain('4=""') + + // curly attributes have no effect on fenced code blocks + const backtick = await render('```js {.foo}\nconst a = 1\n```') + expect(backtick).not.toContain('class="foo"') + const tilde = await render('~~~js {.foo}\nconst a = 1\n~~~') + expect(tilde).not.toContain('class="foo"') + }) + + test('applies to inline elements and blocks', async () => { + expect(await render('*hi*{.cls}')).toContain('') + expect(await render('`code`{.cls}')).toContain('class="cls"') + expect(await render('text {.cls}')).toContain('

') + expect(await render('- item\n{.cls}')).toContain('