I think I've found a solution I'm comfortable with:
- Convert the code to html (":TOhtml" in vi)
- In the Compose tab, type: <pre> </pre>
- Paste you code between the tags
- Publish
For extra credit, you can modify the css for <pre> sections.
If you want line numbers:
- ":set nu" - show line numbers in vi
- ":TOhtml" - convert to html
- ":set nonu" - remove line numbers for easy copy & paste (or, use Ctrl-V)
1 #include <stdio.h>All that's left is to find a good color scheme for vi.
2
3 int main( int argc, char *argv[] ) {
4 printf("Hello World!\n");
5 return 0;
6 }
edit: Ars Pythonica has added that in your .vimrc file, you can add: "let html_use_css = 1" to include css in the output.
Thanks to:
- Eli Bendersky - for the pre trick
- FluidBlog - For the vi TOHtml trick
Good. That's what I'm looking for!
ReplyDeleteThx, that's very useful.
ReplyDeleteActually the one used on my blog post (you linked) is from Google :)
ReplyDeleteI like the fact that it is a general-language highlighter without the need to specify the language explicitly.
Cheers.
It's really AWESOME!!
ReplyDelete