How can I make source code listing block in HTML?
This site has the pretty source code listing.
Looking into the source code I get this HTML code.
<pre class="brush: cpp; wrap-lines: false;">
#ifndef PROGRESSSTATE_H_
#define PROGRESSSTATE_H_
class ProgressState {
...
#endif /* PROGRESSSTATE_H_ */
</pre>
开发者_JS百科It seems to me that the css does the magic. If so, what's the css should look like for having the source code listing? If not, what's the way to have the source code in HTML?
It is probably using a javascript highlighting library such as syntaxhighlighter.
The javascript will pick up the CSS class name and use the brush
value to highlight the contents of the <pre>
tag the way you see it.
It is done with lots of changes to the DOM - additional divs and spans with specific styles.
精彩评论