-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Inconsistent code block line numbers when word wrap is on #7907
Copy link
Copy link
Closed
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its executiondomain: themeRelated to the default theme componentsRelated to the default theme componentsstatus: accepting prThis issue has been accepted, and we are looking for community contributors to implement thisThis issue has been accepted, and we are looking for community contributors to implement this
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its executiondomain: themeRelated to the default theme componentsRelated to the default theme componentsstatus: accepting prThis issue has been accepted, and we are looking for community contributors to implement thisThis issue has been accepted, and we are looking for community contributors to implement this
Type
Fields
Give feedbackNo fields configured for issues without a type.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
When we pass the
showLineNumbersprop to code block, and we toggle the word wrap button (the code block must have at least one line wider than the code block width), the line numbers are not consistent. Also there are some unintended line breaks when word wrap is on.Reproducible demo
No response
Steps to reproduce
npx --yes create-docusaurus@latest website classicdocs/tutorial-basics/create-a-page.md:showLineNumbersprop to the code block. Serve the website and go to http://localhost:3000/docs/tutorial-basics/create-a-pageWord wrap off:

Word wrap on:

Expected behavior
Line numbers should be consistent. No changes to line numbers. Unnecessary line breaks for lines narrower than the code block width.
Actual behavior
Inconsistent line numbers after the wrapped line. Also there are line breaks for lines narrower than the code block width.
Your environment
Self-service