Markdown-preview-enhanced: Line number in code blocks (new feature)

Created on 19 May 2017  路  11Comments  路  Source: shd101wyy/markdown-preview-enhanced

Hi!

Could it be possible to show the line number in the code blocks as below?

1   // Declare myVariable
2   var myVariable string
3 
4   // Another comment
5   myVariable = ...

Is a very useful feature when you are describing the code and want to reference a specific line.

Most helpful comment

My plan is to support class:"lineNo" so that the lineno will be added to the class list of code block.
And lineno class will show line numbers.
For example:

screen shot 2017-05-22 at 9 41 09 pm

I have finished implementing this feature here.

However, I will not release the new version so soon because I am also working on some other new features. Feel free to give me suggestions.

Thanks :)

All 11 comments

Hi @dtgoitia ,

How would you like it to be supported? So you want all code blocks to have line numbers? Or only some specific code block to have line number?

Thanks

Hi @shd101wyy ,

I think the best way is that only some specific code blocks have line numbers, so that old markdown files can keep their style consistent if they will.

I don't how would be easier to achieve this. Maybe to create a new type of code block? Or maybe an optional flag in some point of the code block could enable the line numbers?
2017-05-21 08_52

Many thanks for your interest!

My plan is to support class:"lineNo" so that the lineno will be added to the class list of code block.
And lineno class will show line numbers.
For example:

screen shot 2017-05-22 at 9 41 09 pm

I have finished implementing this feature here.

However, I will not release the new version so soon because I am also working on some other new features. Feel free to give me suggestions.

Thanks :)

That's exactly what I was looking for. Great job @shd101wyy !

@dtgoitia Done!

Cheers :)

Done, check this doc.
Cheers :)

@shd101wyy it works great using {.lineNo}, and it does work stating only lineNo too, but the second options shows the numbers left aligned without any margin. Not an issue, though :)

Hi @dtgoitia , this is now changed again. Check this doc.

Thanks for the update @shd101wyy ! :D

Hi @shd101wyy , in Atom, the line-numbers feature will affect the code color of the block. Is there any solution? e. g.

problem

Best,

Tao

@GHjiangtao2014 try installing language-gfm-enhanced.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yushukk picture yushukk  路  3Comments

fengxs269 picture fengxs269  路  4Comments

xu4wang picture xu4wang  路  5Comments

rcmalli picture rcmalli  路  4Comments

oneone1995 picture oneone1995  路  5Comments