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

Feature: add line numbers to code blocks #12033

Open
wscott opened this issue Apr 2, 2019 · 4 comments
Open

Feature: add line numbers to code blocks #12033

wscott opened this issue Apr 2, 2019 · 4 comments
Labels
area: markdown feedback wanted new feature A proposed new feature for the product

Comments

@wscott
Copy link

wscott commented Apr 2, 2019

I would like to have code blocks with line numbers.

I want to be able to add something to this:

apple
orange
banana

To make it look something like this:

 1 | apple
 2 | orange
 3 | banana

It would make it easier to talk about the source code snippet I pasted in a chat if I can refer to sections by line numbers. I would be OK if line numbers where just included by defualt (or with a per-orginization setting). Or numbers could be requested with an optional field after the highlightly option:
```c++,numbers

@timabbott
Copy link
Sponsor Member

This behavior in our markdown processor is controlled by the linenums flag. I'm not sure what the right model should be here for controlling whether or not to show line numbers.

@zulipbot
Copy link
Member

zulipbot commented Apr 2, 2019

Hello @zulip/server-markdown members, this issue was labeled with the "area: markdown" label, so you may want to check it out!

@Gittenburg Gittenburg added the new feature A proposed new feature for the product label Jul 9, 2020
@certik
Copy link

certik commented Jun 23, 2021

I would love to see that too, came here to open an issue, but it's already open. :)

@ayala-io
Copy link

ayala-io commented Jul 8, 2022

I would very much love to see this. HackMD (a popular cloud-based markdown editor) makes this optional by allowing the user to add an = to the source code snippet, for example:
```c++=
⮤This would add C++ syntax highlighting and line numbers

```c++=10
⮤This would add C++ syntax highlighting and line numbers with the starting line set to 10.

```=
⮤ No syntax highlighting, just line numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: markdown feedback wanted new feature A proposed new feature for the product
Projects
None yet
Development

No branches or pull requests

6 participants