Best way to post code snippets
My blog (randomascii.wordpress.com) is about programming so I post a lot of code snippets. If I was using wordpress on my own host then I could use GeSHI but I’m not sure what the best options are when hosted at wordpress.com. I’m sure this must be a common question.
If GeSHI is available it would be good to make that more obvious.
Thanks for any help you can give.
The blog I need help with is randomascii.wordpress.com.
Ah — very helpful. Yep, that works. Thanks.
However I’m finding that it is very difficult to get [sourcecode] to work with Windows Live Writer. The new-line characters get stripped out on upload (apparently) which means that each code snippet shows up as a single line. I’ve tried fixing this up after uploading a draft, but the editor on wordpress.com only shows five lines(!!!) of the post at a time, which makes it painful to use.
Any suggestions on how to manage this? I could write a filter that fixes up the HTML after I upload it, but that seems clunky so I must be missing something.
I’ve tried fixing this up after uploading a draft, but the editor on wordpress.com only shows five lines(!!!) of the post at a time, which makes it painful to use.
Settings > Writing
Size of the post box ___lines
That definitely helps a lot. Thanks again.
There are various other complexities in getting the source code in, but I think I’ve got them under control. The one remaining problem is that now when somebody tries to copy the source from my blog, it comes up double-triple spaced — five blank lines after every line of code. That seems quite unfortunate. This is using IE9, for what that’s worth.
Who knew this would be so difficult!
Oh, and I did use light=”true” to get rid of the line numbers, since otherwise those get copied as well, which is undesirable.
The topic ‘Best way to post code snippets’ is closed to new replies.