开发者

How can I make source code listing block in HTML?

This site has the pretty source code listing.

How can I make source code listing block in HTML?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜