linenums not displayed

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

I am testing this plugin and there appears highlighted code but only with linenumber 1
In the source i see:

<ol class="linenums">
<li class="L0">...</li>

The L1, L2 and so on is not listed.
I did use this pre tag like in the readme file is told:

<pre class="pretty print linenums">code goes here</pre>

What is going wrong with the line numbers?
I switched to default theme when i tested but still are no line numbers

You can look in the source code here: http://forum.webprofis.nl/discussion/comment/1686#Comment_1686

Comments

  • What input formatter are you using?

  • jackmaessenjackmaessen ✭✭✭
    edited December 2014

    i am using HTML input formatter with buttonbar; i also tested it with cleditor but the same result

    I just tested Google code prettify and that one gives me the line numbers...and as far as i can see these two plugins are almost the same....

  • jackmaessenjackmaessen ✭✭✭
    edited December 2014

    I am using now Google Code Prettify with this tag:

    <code class="prettyprint linenums">code here</code> and everything works perfect!

  • edited December 2014

    With my plugin you only need to use the < pre > tag it automatically adds the class lineums.

    Code is not generally to be used with lineums. Code and Pre are not the same thing.

    Code is for a single line of code

    Pre is for several lines of code to maintain the line breaks and add numbers to lines.
    Line breaks 
    more code
    

    My plugin is based on the one used here on this forum. the bellow I got from the source here on this forum.

    My plugin only need to use < pre > and the rest is added via jquery.

    < pre class="linenums prettyprinted" >

    It is irritating when people complain about a plugin or theme, then use something else without waiting for me to get on here and help fix things. Instead of getting down to the bottom of things. Now this discussion points to someone saying my plugin does not work and there is no solution besides using something else. That ticks me off.

    I would rather you did not bother, saves me the wasted time.

    PRE:

    The PRE element tells visual user agents that the enclosed text is "preformatted". When handling preformatted text, visual user agents:

    May leave white space intact.
    May render text with a fixed-pitch font.
    May disable automatic word wrap.
    Must not disable bidirectional processing.
    

    CODE:

    Designates a fragment of computer code.

  • peregrineperegrine MVP
    edited December 2014

    @vrijvlinder‌

    change the code in prettify.js line 26.

    to this

    p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<code>"+a+"</code>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});

    then select your code with mouse and press C (codetag option) in buttonbar it will work with "Markdown"

    $Configuration['Garden']['InputFormatter'] = 'Markdown';

    Html doesn't seem to work

    $Configuration['Garden']['InputFormatter'] = 'Html';

  • That is good , but it sucks that it won't work with html anymore... I do not use markdown..

  • jackmaessenjackmaessen ✭✭✭
    edited December 2014

    I found something interesting: when using the preffity.js from GoogleCodePrettify plugin, Prettyprint plugin also works fine with HTML formatting;. I just tested it and it seems to work: http://forum.webprofis.nl/discussion/296/test-prettyprint-plugin-with-other-javascript

    Also Interesting: when downloading the package from google ( https://code.google.com/p/google-code-prettify/)
    both the two .tar files in which prettify.js, gives to same problem: No Linenumbers.

    As far as i can see is this prettify.js about 14kB and the one in the plugin ( http://vanillaforums.org/addon/googlecodeprettify-plugin) is about 18.7 kB

  • It seems that this highlight plugin ( with GoogleCodePrettify) is the only one which works fine with Q&A plugin.

    I tested GeSHi: when accepting an answer and the comment moves upwards: highlighting is gone!


    This one: http://vanillaforums.org/addon/g_syntaxhighlighter-plugin and this one: http://vanillaforums.org/addon/vanillasyntaxizer-plugin give problems with the popup in a topic when choosing: delete, Q&A; the spinner keeps running but the popup never appears

  • Yes I can confirm it does work ... that script is identical except it does not have the !function in the beginning.

  • peregrineperegrine MVP
    edited December 2014

    @vrijvlinder said:
    Yes I can confirm it does work ... that script is identical except it does not have the !function in the beginning.

    actually the code is completely different. between prettify.js in one plugin vs the other plugin.

  • peregrineperegrine MVP
    edited December 2014

    screenshots?

  • This is what I see

  • You need to refresh the page to see the formatting

  • peregrineperegrine MVP
    edited December 2014

    ok

  • edited December 2014

    I used the pre tag

    html cleditor

    only prettyprint I never used the other one only saw the code.

    2.1.6

  • peregrineperegrine MVP
    edited December 2014

    .

  • edited December 2014

    Same result with button bar it works the same as with cleditor using html, will now switch to markdown.

    Same result with markdown it works as well... cool

  • cool glad it works.

  • Lets hope it stays that way...

Sign In or Register to comment.