Line Numbers in Code Blocks

Hi Team,

I hope you are all keeping well.

We would like to reference a particular line number within the many code blocks shared in our documentation. In the current iteration, there is no way to add line numbers to left side of the code blocks.

Are there any plans to allow for code blocks to optionally contain line numbers in future? This would be very useful when explaining lines of code outside the block itself as we could use the line numbers as reference.

Thank you!

Hey Diana,

Do you just need to add line numbers? Or do you need lines to be referenceable (as in you can link to them)?

To add the line numbers, you can do it for the entire project by using Advanced Settings. You would need to add such a script to Custom HEAD Tags:

  window.settings.apply({code: {showLineNumbers: true}});

There isn’t a way to reference specific lines at the moment.

Hi Zed,

That is perfect! Thank you for your help. No need to reference them via link, just in terms of the text.

Happy to close this ticket out.

Thank you!

1 Like