From 7c09583eaa5ebdc87787c3f1cbbdaa3f44e9d47b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 01:28:24 +0530 Subject: [PATCH] test(markdown): cover attrs behavior before plugin migration Captures what the markdown-it-attrs patch enforces (curly attributes never consume fence info, preserving line-highlight syntax) plus the supported attribute placements, as a regression baseline. Co-Authored-By: Claude Fable 5 --- __tests__/unit/node/markdown/markdown.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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('