xploreraj
xploreraj

Reputation: 4362

How to do Syntax highlighting on code coming from JSON

I need help with Alex Gorbatchev's syntax highlighting. Actually I am saving some code snippet in JSON file and then making AJAX calls to render it in JSP inside some div via JQuery. But the syntax highlighting is not working. If I put text directly then it works, but the content in my webapp is loaded dynamically! Look at the code from debugger below:

Firefox

Firefox

Chrome

Chrome

Upvotes: 1

Views: 1019

Answers (1)

The answer depends on the version of SyntaxHighlighter You are using.

If You are using the latest version (4), you probably would like to use an API:

highlight(params = {}, element = null)

If it's oldest version (3), You could try to restart hilighter via all method:

SyntaxHighlighter.all()

Upvotes: 1

Related Questions