Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to insert source code into a html page.

Here you can find an example.

How can I do this?

share|improve this question

closed as off topic by slhck Oct 14 '12 at 11:40

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
HTML and programming questions are mostly off topic for Super User, but I'm not even sure what exactly you're asking. Can't you just copy the source code into the HTML source and then apply various styles to it, e.g. monospacing, etc.? Or are you asking about the sntax highlighting specifically? –  slhck Oct 14 '12 at 11:41
    
Yes I need the highlighting feature. –  erdomester Oct 14 '12 at 12:37
    
Should be migrated to SO. Valid question (albeit unclear one). –  Nir Levy Oct 14 '12 at 12:56

1 Answer 1

up vote 1 down vote accepted

I'm pretty sure pure HTML can't do this by itself, and you will need to add some scripting to do the highlighting, either on the server-side or the client-side.

SyntaxHighlighter is a JavaScript script that does exactly this, you add it to your HTML page by linking the required .css and .js files, and then mark your code with the required tags.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.