HOWTO post C++ code in Wordpress
wordpressGenerally speaking,
Code Autoescape
is the most popular plugin to quote source code in WordPress, which has
officially killed some competitors. Just wrap the code within code
block, the
plugin would convert the HTML-reserved symbols for you. Unfortunately, it does
not handle >
well, while
stream operation or template
is essential for the C++ program.
CodeColorizer is an online service that use old-styled HTML tags to auto escape the C++ source code to HTML, and you get free, mandatory bonus, syntax highlighting. However, the “smart” wordpress would eat some tag, so the whole style is messed up with unnecessary bold or italic style decoration. C++2HTML does the same job in advanced manner, The HTML code rendered is XHTML 1.1 compliant, and the users may tune the stylesheet to determine syntax highlight style. That is also the solution used in all C++ Style Study Note.
UPDATE: until recently, I found another WordPress plugin: code snippet. This plugin claims that they can render more than 50 programming languages powered by GeSHi. I have to disable the WYSIWG editor in order to have more control of the raw HTML code.