0

This is an extension to a question previously asked here: Emphasizing lines with highlight.js

That is, I want to display source code on a web page and highlight a line of it. I am using Highlight.js and highlightjs-highlight-lines.js to do that. All works.

But since I want to limit the amount of vertical space associated with the "code" block, I specify a height property and the highlightjs code block now has a scrollbar when the source code to be displayed is too long to fit into the given height.

So the question is: how do I force the highlighted line to appear in the middle of the viewport? I.e. how do I autoscroll to the part in the source code that's actually highlighted?

wolfman
  • 123
  • 9

0 Answers0