Skip to content

feat(transformers): add transformerRenderLineNumber#1238

Open
Divyapahuja31 wants to merge 3 commits intoshikijs:mainfrom
Divyapahuja31:feat/transformers-render-line-number
Open

feat(transformers): add transformerRenderLineNumber#1238
Divyapahuja31 wants to merge 3 commits intoshikijs:mainfrom
Divyapahuja31:feat/transformers-render-line-number

Conversation

@Divyapahuja31
Copy link
Copy Markdown
Contributor

  • -

Description

This PR introduces a new transformer: transformerRenderLineNumber.

What:
It renders line numbers as individual <span> elements (with class line-number) at the beginning of each line.

Why:
Currently, adding line numbers requires custom CSS counters or external implementation. This transformer provides a standardized, accessible, and easily copy-protected way to add line numbers directly to the AST.

Features:

  • Configurable start index (default: 1).
  • Configurable class name.
  • easy to style (e.g., user-select: none to prevent copying).

Changes:

  • Added transformers/render-line-number.ts.
  • Exported from transformers/src/index.ts.
  • Added documentation and examples.
  • Added comprehensive tests.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 7, 2026

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 5a086f2
🔍 Latest deploy log https://app.netlify.com/projects/shiki-next/deploys/6986e8cebe501900082d2b0f
😎 Deploy Preview https://deploy-preview-1238--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 7, 2026

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 5a086f2
🔍 Latest deploy log https://app.netlify.com/projects/shiki-matsu/deploys/6986e8ce2876af00086c5918
😎 Deploy Preview https://deploy-preview-1238--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.26%. Comparing base (49cbb76) to head (5a086f2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1238      +/-   ##
==========================================
+ Coverage   95.25%   95.26%   +0.01%     
==========================================
  Files          92       93       +1     
  Lines        8007     8033      +26     
  Branches     1705     1707       +2     
==========================================
+ Hits         7627     7653      +26     
  Misses        374      374              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant