Line numbers for code blocks
I use discord for two things;
- Programming servers
- Chats with coworkers (surprise - we're programmers)
Meaning the markdown code block is a very core pert of my (and many other developers') experience on discord.
In my opinion, the code block should reflect the visuals of a text editor or IDE, that's part of the reason syntax highlighting was added to the code blocks both in discord's markdown interpreter and in pretty much every other markdown viewing tool out there.
The thing thats missing is line numbers.
At first this might seem pointless or mundane, but just hear me out.
In most of the severs I'm in we often help people with their code, sometimes hundreds of people are helped every hour in one of the servers, and how do we do it? The code block!
The biggest pain is directing people to a particular part of their code thats causing the issue, I say things like "in the function 'foo' the second for loop, the third if statement in there about seven lines down" etc, and it really is the most efficient method we have of communicating this, especially in larger pieces of code where manually counting 50 lines or more is just not gonna happen.
The solution? Line numbers.
I'm honestly quite surprised that its not a standard for markdown. Having line numbers in code blocks would make things so much easier, compare my earlier directions to broken code with the following; "line 28".
It makes sense to have line numbers. If you aren't convinced, it will go a long way to fix the ugly word wrapping that happens and makes code appear to have mostly random indentation, when in reality its just the result of code blocks being too dissimilar to the IDEs that, lets be honest, 99% of code blocks have their content copied from.
-
As a fellow coder myself, sometimes I ask people questions by pasting my code on Discord, but sadly, I have to manually count the lines. This is a simple and easy feature to add, I think implementing it would be very beneficial.
2 -
I see a related post: https://support.discord.com/hc/en-us/community/posts/360040487652-Add-line-numbers-to-code-blocks
Not sure why it hasn't caught any eyes yet. It's a big pain without line numbers0
Please sign in to leave a comment.
Comments
2 comments