Skip to content

Conversation

@ZothOmmog
Copy link

@ZothOmmog ZothOmmog commented Nov 13, 2025

Fixes #835

This PR adds the ability to display line numbers in code blocks. Users can now toggle line numbers visibility through a checkbox in the code block toolbar.

image

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

@ZothOmmog ZothOmmog force-pushed the code-block-show-line-numbers-outer-html branch from e9ced82 to 25a1ae6 Compare November 17, 2025 16:10
@ZothOmmog ZothOmmog changed the title line numbers with dom modification feat(code-block): support line numbers in code blocks Nov 17, 2025
@ZothOmmog ZothOmmog force-pushed the code-block-show-line-numbers-outer-html branch 3 times, most recently from c02bc1e to 31c53f6 Compare November 18, 2025 11:33
@ZothOmmog ZothOmmog force-pushed the code-block-show-line-numbers-outer-html branch from 31c53f6 to b8233d1 Compare November 18, 2025 11:50
getAttrs: (tok) => {
return {
[CodeBlockNodeAttr.Line]: tok.attrGet('data-line'),
[CodeBlockNodeAttr.ShowLineNumbers]: tok.info.includes('showLineNumbers')
Copy link
Author

Choose a reason for hiding this comment

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

This change exists to render this markup without line numbers

    line 1
    line 2
    line 3

Not sure, maybe it should be like this because indented code doesn't have attr showLineNumbers

[CodeBlockNodeAttr.ShowLineNumbers]: ''

@ZothOmmog ZothOmmog force-pushed the code-block-show-line-numbers-outer-html branch from 631b6b3 to 0c68ddc Compare November 18, 2025 13:28
@ZothOmmog ZothOmmog force-pushed the code-block-show-line-numbers-outer-html branch from 0c68ddc to d214ab9 Compare November 18, 2025 13:33
@ZothOmmog ZothOmmog marked this pull request as ready for review November 18, 2025 13:50
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.

Support line numbers in code blocks

2 participants