line numbers in code block

jackmaessenjackmaessen ✭✭✭
edited December 2013 in Vanilla 2.0 - 2.8

hello,
I am using vanilla 2 and i enabled GeSHi for syntaxhighlighting. It all works fine but i do not see the linenumbers in the message when posted. It is enabled in GeSHi. I also tried google prettifier for syntaxing and the same problem: only highlighting but no line numbers.
How can i set the line numbers when users put a code block?

Comments

  • hgtonighthgtonight MVP
    edited December 2013

    Welcome to the community!

    It looks like GeSHi (and the plugin in this repo) supports line numbers out of the box. You need to add a line attribute to your 'pre' elements. Something like this:

    < pre line="1">
      // This is my code
    </pre>
    
  • jackmaessenjackmaessen ✭✭✭
    edited December 2013

    Perfect! this does the job. I now use per example lang="php" and line="1" between the pre tags and it gives me a perfect block of code with the right higlighting and linenumbers for the specific language. Thank you very much

Sign In or Register to comment.