How to put source code sample into the post
Hi,
I'd like my users to be able to put source code samples inside posts on my web page - what is the best way to put code, maybe with coloring also...?
For example - when I try to put some C++ program I get first line ( [hash] include.....) wrongly "understood" by Vanilla... plus the line formatting is wrong...
include
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Ps. This probably depends on WYSIWYG editor plugin on my page... I use CLEditor... What would be better in this case?
0
Answers
use
another way
inline snippet use backticks
`snippet`
or use
<code>snippet</code>
wsiwyg editors can be configured to wrap code, however is good to be able to switch to source code.
grep is your friend.
It does not work... for example here - when I write a comment and I want to put a line "hash include bracket iostream bracket" (using code keyword) I get:
include
Try it yourself....
im using GoogleCodePrettify 0.3 addon
addon : http://vanillaforums.org/addon/googlecodeprettify-plugin
demo : http://geek.lk/discussion/40
maybe this will help
http://vanillaforums.org/discussion/comment/157262#Comment_157262
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
do it like so
Yes that is right
<
, this is a limitation of this parser.grep is your friend.