I
I
IDMan2010-09-29 18:04:15
Syntax highlighting
IDMan, 2010-09-29 18:04:15

Syntax highlighting?

There is a library for syntax highlighting on a web page - SyntaxHighlighter ( http://alexgorbatchev.com/SyntaxHighlighter/ ). Blocks of text on the page (in the pre tag by default) are colorized when the page is initialized.
Problem: after the text in the block has changed, for example, as a result of Ajax, it loses coloring. How to ask the library to process a certain block again?
Note:
after the SyntaxHighlighter has run, the pre tags are replaced by others specified by the editor (the div in which the table is nested, and so on). My script writes text to the pre tag again.
PS In other words, how to force the module to color a certain block of code on the page, which appeared after the module had completed its work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
[
[email protected]><e, 2010-09-29
@IDMan

In the second version, I used

SyntaxHighlighter.highlight(0, node)

Where node is unhighlighted pre.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question