changing pre tag to code

This discussion is related to the CreativeSyntaxHighlighter addon.
jackmaessenjackmaessen ✭✭✭
edited November 2015 in Feedback

There seems to be a problem with using the pre tag in combination with html in it. The html is executed between the pre tags.
Like in this discussion ( http://vanillaforums.org/discussion/28637/posting-html-code#latestalready) was told; you can avoid it to add code tags within the pre tags like below:

    <pre lang="html">
    <code>
   html  code goes here
    
    

But doing it like above, the output in the codeblock will be:

<code>
html code goes here

So the advise of @creativedreams to change the pre tag in code is a good option. This should be changed in the file shInit.js in the js folder of the plugin:

......
'tagName':       'code',     // Facilitates using a different tag.
.....

But that is not enough to make it work. What happens: if you submit a piece of code, the highlighter seems to work normal. But after a refresh, the complete div with its unique , table, class gutter and code inside it, is gone.
You need to make 2 more changes; in the file shLegacy.js and in the file shCore.js, both in the js folder.
In those 2 files, search for "pre" and change the "pre" to "code"

In shLegacy.js:
....getAttribute|textarea|object|push|pre|className|highlight|document|getElementsByTagName....

In shCore.js:
....createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline....

Well, i thought this might be useful for the developer and for other users who wants to change from pre to code tag

hgtonight

Comments

Sign In or Register to comment.