#68 add support for showing line numbers next to highlighted code blocks

Merged
hz merged 5 commits from :line_numbers into master 1 month ago
hz commented 1 month ago

Resolves #62 by adding support for showing line numbers in highlighted code blocks.

Two ways to specify:

  • adding -lines to the end of the specified language to turn it on for a single block (e.g., ```py-lines).

  • setting cs_code_line_numbers = True to apply to all highlighted code blocks.

Resolves #62 by adding support for showing line numbers in highlighted code blocks. Two ways to specify: * adding `-lines` to the end of the specified language to turn it on for a single block (e.g., <code>```py-lines</code>). * setting `cs_code_line_numbers = True` to apply to _all_ highlighted code blocks.
hz added this to the 2020.9.0 milestone 1 month ago
hz added the
enhancement
label 1 month ago
hz commented 1 month ago
Owner

Attaching an example screenshot (show blocks with and without line numbers). I’m not 100% thrilled with how this looks, but I think it might be OK? Can revisit later.

Attaching an example screenshot (show blocks with and without line numbers). I'm not 100% thrilled with how this looks, but I think it might be OK? Can revisit later.
edemaine commented 1 month ago

Maybe coloring/styling the lines numbers (possibly not even in fixed-width font) would help them stand out?

For example, check out this example of the LaTeX listing package from this Overleaf tutorial:

image

Maybe coloring/styling the lines numbers (possibly not even in fixed-width font) would help them stand out? For example, check out this example of the LaTeX `listing` package from [this Overleaf tutorial](https://www.overleaf.com/learn/latex/code_listing): ![image](/git/attachments/8769cc1c-7637-49f2-a65a-3cc3751e57cb)
hz commented 1 month ago
Owner

Good call. I think both the different background color and the different font for the line numbers are helpful. I’m not very CSS-savvy, but I’ll see if I can make something that looks decent.

Good call. I think both the different background color and the different font for the line numbers are helpful. I'm not very CSS-savvy, but I'll see if I can make something that looks decent.
hz commented 1 month ago
Owner

OK, I made some changes to the style that I think are a big improvement. Interested in a second opinion if you don’t mind having a look!

without line numbers

with line numbers

OK, I made some changes to the style that I think are a big improvement. Interested in a second opinion if you don't mind having a look! ![without line numbers](https://catsoop.mit.edu/git/attachments/307b95e8-de16-4874-865c-6aaca802c9ee) ![with line numbers](https://catsoop.mit.edu/git/attachments/725bd1e0-3466-4797-ba0b-46ef86796873)
edemaine commented 1 month ago

Looks nice! That background color helps a lot.

Looks nice! That background color helps a lot.
hz commented 1 month ago
Owner

Great, thanks for the input here! Merging now.

Great, thanks for the input here! Merging now.
hz closed this pull request 1 month ago
hz deleted branch line_numbers 1 month ago
The pull request has been merged as 6316a5fbf1.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.