Formatting C++ code to html (mac, linux)

Hmm, it turns out turning C++ code into html is both harder (nothing obvious) and easier (a great tool) then you’d expect. For the previous post on expanding $var I just used:

enscript -B -E -u "" -T "" --language=html --color Strings.cpp -p ~/Strings.cpp.html

and copied the resulting html into the post.
The coolest thing I found was GeSHi (Generic Syntax Highlighter) which is written in php and so more suitable for web sites.
If I were using WordPress, there’s a
that use the “<pre lang=”C++”/>” tag

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.