Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax highlighter not working

I am just following the instruction over here and its not working any help?

<script type="text/javascript" src="sh/src/shCore.js"></script>

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>

<link href="sh/styles/shCore.css" rel="stylesheet" type="text/css" />
<!--<link href="sh/styles/shCoreDefault.css" rel="stylesheet" type="text/css" />-->
<link href="sh/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />

<pre class="brush: js">
    /**
     * SyntaxHighlighter
     */
    function foo()
    {
        if (counter <= 10)
            return;
        // it works!
    }
</pre>
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>

Found some error in console don't know wt to do with it.

Uncaught ReferenceError: XRegExp is not defined shCore.js:123 Uncaught TypeError: Cannot read property 'Highlighter' of undefined shBrushJScript.js:45 Uncaught TypeError: Cannot read property 'all' of undefined test.php:21 Attr.specified is deprecated. Its value is always true.

like image 232
Skyyy Avatar asked May 21 '14 05:05

Skyyy


People also ask

How do I turn on syntax highlighting?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

How do I enable syntax highlighting in Notepad ++?

To configure syntax highlighting, click on “Language” in the top bar, then click the letter the language starts with, and then the language. If you want to define your own language, click on “Language” again, then click on “User Defined Language”, third from the bottom, and then click “Define your language”.

How do you use Prism syntax highlighter?

Go to the Prism project homepage (https://prismjs.com/), then to the download page as before, and generate a script file selecting only the coding languages you are interested in; don't reselect any plugins. Then download the JavaScript file. Remember: do not download the CSS file, only the prism. js file.

What syntax highlighter does Vscode use?

VS Code uses TextMate grammars as the syntax tokenization engine. Invented for the TextMate editor, they have been adopted by many other editors and IDEs due to large number of language bundles created and maintained by the Open Source community.


1 Answers

I found this LINK

Try to keep all your local files for syntax highliter in same directory like this:

<script type="text/javascript" src="sh/src/shCore.js"></script>

<script type="text/javascript" src="sh/src/shBrushJScript.js"></script>

OR

<script type="text/javascript" src="sh/scripts/shCore.js"></script>

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>
like image 178
Imran Bughio Avatar answered Oct 05 '22 23:10

Imran Bughio