R4D4
R4D4

Reputation: 1402

Embedding C/C++ code with syntaxhighlighting into HTML with javascript

Hopefully somebody can point me to something that could help. What I'm doing is designing a few things in a HTML document, but I'd really like to be able to have blocks of C/C++ (not too worried, although I imagine C would be easier) code in the design document. The problem I have is formatting the code - as I'd ideally like syntax highlighting.

I know the above is very possible - many sites that allow code to be entered do this, but what I'm wanting is for this to be possibly done in javascript so that everything can be contained nicely in a html file that can just be browsed and edited locally with no hassle for running an (albeit probably a simple) web server. I don't suppose anybody knows of such a javascript tool that can do this?

Thanks very much. :)

Edit: Remarkable - I've spent the past 1 1/2 hours looking for something like this and the next search I make after writing this question gets me this! I shall leave this question open a little to give others a chance to post so that if the above doesn't suit somebody, then perhaps another solution will.

Upvotes: 3

Views: 1883

Answers (1)

R4D4
R4D4

Reputation: 1402

Time to close. Here's a few javascript syntax highlighters:

SyntaxHighlighter

A collection of 9 scripts

Upvotes: 2

Related Questions