Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book: Code block line numbers #155

Closed
azriel91 opened this issue Jun 27, 2023 · 1 comment
Closed

Book: Code block line numbers #155

azriel91 opened this issue Jun 27, 2023 · 1 comment

Comments

@azriel91
Copy link
Owner

Currently the book uses [email protected], which:

  • Breaks code snippet copying: As it uses <table> elements, it causes the copied code to contain extra newlines.
  • Also necessitates a lot of hacky CSS rules so that mdbook's table styling doesn't interfere with the code blocks' styling.

Probably worth writing the same functionality without using <table> elements.

Figure out how to add <span>s for each line in the code block as a hljs plugin, then CSS counters to add the counter.

Links:

@azriel91
Copy link
Owner Author

Closed by #163 in commit fcc0cb5.

Source code of the highlightjs line numbers is at: https://github.com/azriel91/highlightjs-line-numbers.js/blob/feature/mdbook-support/src/highlightjs-line-numbers.js

Permanent solution would be solved in: rust-lang/mdBook#1303

@github-project-automation github-project-automation bot moved this from Todo to Done in Peace: UI Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant