Source code highlighting and line numbers in Markdown
Please support syntax highlighting when embedding source code in Markdown. The syntax for it seems supported, but no highlighting happens:
```java public class Example { } ```
Also, we often require students to refer to particular lines of a piece of code in an assignment. Right now, we add line numbers by hand. It would be awesome if we could somehow get line numbers near code blocks automatically.
Submitted by Robbert Krebbers on 9 February 2017 at 14:19
Issue Log
Funny that you added this issue just now, as I just added syntax highlighting for markdown code blocks, ready for next release (within a week).
I haven’t enabled line numbers, but I can also add this option.
Awesome, that’s great timing :).
Does Markdown have syntax to let the user decide whether he/she wants line numbers?
It is possible to add that (it’s not part of any markdown spec that I’m aware of ), but this would take more time. Not urgent enough for me, so let’s just add line numbers, instead of making this optional.
Alright, just to be sure, I will only get line numbers when I specify a language? So, when I use
```java
but not when I use just
```
?
Getting line numbers in the latter would be confusing, as we already have hardcoded line numbers for many existing code snippets.
Yep, no language = no line numbers.
Log in to post comments