Skip to content

Feat: Add Option to Show Line Numbers for Specific Languages#75

Merged
timlrx merged 3 commits into
timlrx:mainfrom
skiende74:feat/show-line-numbers-option-languages
Apr 5, 2025
Merged

Feat: Add Option to Show Line Numbers for Specific Languages#75
timlrx merged 3 commits into
timlrx:mainfrom
skiende74:feat/show-line-numbers-option-languages

Conversation

@skiende74

@skiende74 skiende74 commented Mar 31, 2025

Copy link
Copy Markdown
Contributor

Issue: #74

Description:
This pull request extends the showLineNumbers option from a boolean to boolean | string[]. Currently, setting showLineNumbers to true displays line numbers for all code blocks that include the meta property 'showLineNumbers'. With this change, you can specify an array of languages (e.g., ['typescript']) to show line numbers only for those languages. Other languages, like plain text, will not display line numbers.

Changes:

  • Type Update: Change showLineNumbers type from boolean to boolean | string[].
  • Logic Modification: Update the line numbering logic to check if showLineNumbers is an array. If it is, only add line numbers for code blocks whose language is included in the array.
  • Documentation: Update docs and examples to reflect the new functionality.

Usage Examples:

// Display line numbers for all code blocks
showLineNumbers: true

// Display line numbers only for code blocks with the 'typescript' or 'java' language
showLineNumbers: ['typescript', 'java']

@timlrx timlrx left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@timlrx timlrx merged commit ded5243 into timlrx:main Apr 5, 2025
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