Skip to content

fix(highlight): stop injecting tabindex="0" on pre blocks#239

Merged
farnabaz merged 1 commit into
mainfrom
fix/highlight-pre-tabindex
Jun 11, 2026
Merged

fix(highlight): stop injecting tabindex="0" on pre blocks#239
farnabaz merged 1 commit into
mainfrom
fix/highlight-pre-tabindex

Conversation

@benjamincanac

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The highlight plugin hardcoded tabindex="0" on every <pre> block, so it leaked into the output of every consumer whether they wanted it or not.

  • Removed the tabindex: '0' injection in highlightCodeBlocks (packages/comark/src/plugins/highlight.ts).
  • Dropped tabindex from the pre implicit-drop list in attributes.ts so a genuine user-supplied {tabindex="0"} now round-trips back to markdown instead of being silently stripped. style stays dropped since it's still injected by preStyles.
  • Updated the 11 shiki SPEC fixtures to match (AST + HTML).

All pnpm test pass (1064 tests).

📝 Checklist

  • I have linked an issue or discussion.
  • I have run pnpm verify and it passes.
  • I have updated the documentation accordingly.

The highlight plugin hardcoded tabindex="0" on every <pre> block, polluting
output for all consumers. Remove it and let user-supplied tabindex round-trip
back to markdown instead of being dropped.
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Jun 11, 2026 1:25pm
comark-json-render Ready Ready Preview Jun 11, 2026 1:25pm
comark-nextjs Ready Ready Preview Jun 11, 2026 1:25pm
comark-nuxt Ready Ready Preview Jun 11, 2026 1:25pm
comark-svelte Ready Ready Preview Jun 11, 2026 1:25pm
comark-sveltekit Ready Ready Preview Jun 11, 2026 1:25pm
comark-twoslash Ready Ready Preview Jun 11, 2026 1:25pm
comark-vue Ready Ready Preview Jun 11, 2026 1:25pm

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@239

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@239

@comark/html

npm i https://pkg.pr.new/@comark/html@239

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@239

@comark/react

npm i https://pkg.pr.new/@comark/react@239

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@239

@comark/vue

npm i https://pkg.pr.new/@comark/vue@239

commit: 87692e7

@farnabaz farnabaz merged commit 11e7fa0 into main Jun 11, 2026
11 checks passed
@farnabaz farnabaz deleted the fix/highlight-pre-tabindex branch June 11, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants