Here at Automattic we’re allllll about sharing source code. We’re easy, we give it away.
Tragically, though, using WordPress.com it is really, really hard to post source code. You have to know about HTML encoding, pre and code tags, and if you want any slick highlighting you have to convert it before you post it. You have to jump through all sorts of hoops.
Isn’t this much cooler?
$features = file_get_contents( 'https://wordpress.com/features/' ); preg_match_all( '|<h3>(.*?)</h3>|is', $features, $why_wp_rocks ); foreach ( $why_wp_rocks[1] as $slick_feature ) $hotness[] = $slick_feature; var_dump( $hotness );
If you want to know how to drop that science check out this FAQ entry, it’s as easy as a blog post on a Sunday. Like , we realize this feature will probably not appeal to many people, but if you’re the type that writes about programming your blogging life should be easier now.
Here’s another editing tip: if you press Shift + Enter it gives you a single line break instead of a double one.
Happy Labor Day!
I’ll try this one.
Looks like you folks labored this Labor Day weekend. I don’t do or write about programming, but I’m s-l-o-w-l-y learning about code just being here. Thanks for the links. We like you!
Cool feature! Nice job!
Great stuff! Thanks.
Thanks for this great feature! The thing most unpeasant about using blockquotes / code tags was that two minus-es (used as command line switches for example) got converted into a single dash. I haven’t checked yet, but I hope this is fixed with [sourcecode].
this is nice 🙂
It’s geek-o-licious.
What, no AJAX?
The scientifically impossible I do right away
The spiritually miraculous takes a bit longer
Ah displays very neatly, nice Matt, very nice =) Though, it’s in my opinion that I do not like the horizontal bar. I also love the header options *thumbs up*
Nice! 🙂
I really love you guys.
Every little thing you do makes me so happy, I know it’s silly.
Thanks.
cooooool I would love to try it 😉
and yea .. the editing tip… is something that I’ve been waiting for 😀
thanks
Exactly what I was looking for. You’re a star. Thanks.
Now that is cool, I might actually post some code now!!
Sourc-ey!! Ooops…I meant Saucy!!!!
Not a bad feature!! Should be handy by times… Thanks!
Erm, … but why isn’t the ‘code’ button visible in wysiwig mode? Why do we still have to switch to the ‘code’ mode? Why not having the botton in both modes?
Good one 😀 Cheers Matt!
very useful…
I said this problem in furums yesterday and now you fix it. thanx
Thanks for the editing tip.
I always wondered how to get a single line break.
Thanks guys.
wow! this is great!!! i’ll use this when I want to share my codes to others! Thanks WordPress!
Thanks a lot. This feature is definitely useful for me.
very cool and useful!
Looks nice, just a pity with the bottom scrollbar if you use larger than the default font 😦
I already tried latex and it was fun…thanks for sharing this code 😀
Thanks, sometime I used to post html code, that I had in text file located elsewhere. This will be useful.
Another great update, eh?
Thanks a lot. 😀
YES!
At last. I please you for this feature. Thanks!
I dont know much about source code but I learn! Thanks
Wow, looks really nice. Thanks!
Awesome! It’s a wonderful feature!!! Thanks guys!
simply wondarful. bless.
Shirt + Enter… YAY…!!
Guess I’m a little too young for programming but fluent in UBL – Universal Baby Language. Maybe you can add it – only very few keywords used there 🙂 .
Anyhow great.
I’m not one who’s going to be posing much code, but I’ve been wanting something that’ll do a single line break for ages. Thank you! You’ve now ended quite a bit of frustration
thanks a lot! that’s really helpful!
wow. thanks great matt!!
U guys rock!!!!
As u said, it wont appeal many…but I am glad it makes my blogging life easy.
Keep rolling.
Cheerz
Sridhar
Ummm, not for me…wysiwyg works just fine.Thx!
Hey Matt,
I’ve ran into the same problem on wordpress.
Try “:TOhtml” in vim. It exports syntax highlighting for whatever file you are editing like C, PHP, Python, bash, etc.
You may have to tweak the html a bit afterwards, but it produces great results. See: http://electronjunkie.wordpress.com/2007/06/30/sigma-delta-modulation-primer-part-ii/ for an example.
-ej
Go WP!
Shift + Enter also opens a link in a new window. :p
Happy Labor Day!
I have no reason to use this feature, but I appreciate how much ya’ll have worked to make WordPress the greatest!
Matt, how’d you get to be so cool?
Yep, much cooler. As someone who does blog about programming occasionally this will be helpful, thanks.
Woo-hoo! I was having HTML scratches to write codes before. Thanks — as usual! 😀
That shift+enter thing is the real winner here.
good
It’s a good idea, but it’s pathetic that it doesn’t support Perl syntax highlighting yet considering the twelve languages there.
If you’d like Perl support contribute it to the open source project linked in the FAQ and we can add it.
Oh this is great! This is really going to make life easier for me on my blog.
Very nice indeed. Been looking for this for quite a while. Thanks.
Cool!
very awesome.
shift+enter is a great trick, i’m surprised more people don’t know about it.
Thanks for this, really is need. I know XHTML and bought th Custom CSS upgrade… but never could highlight the language sintax by hand.
“Here’s another editing tip: if you press Shift + Enter it gives you a single line break”
Now that makes me very happy! No more writing haiku in notepad first 🙂
Hello Matt (from greece) !!!
Thanks for the tips and please do not stop sharing with us 😉
Seems perfect!
And is just what I need!
Sweet. I like this. Thanks Matt.
Very impressive. Thank you guys!
It always confuses me that labor day is a different day in the states, and I do not post source code all that often, but anyway: thanks, and happy labor day to you as well.
Just in time, I was planning on posting up some source code today. 🙂
You don’t support perl 😦
WordPress is truly the gift that keeps on giving. I should probably be embarrassed to have this much joy at a new feature. Thank you!
Cool!
But I think it should be great if it could have “themes”, even if there were only 2: light (the actual) and dark.
This would be good for people, like me, whom use dark themes. The source code actually draws too much attention to itself.
woo! 🙂
I’ll use this.some day. very soon 🙂 probably…
Woohoo — I’d even started up a self-hosted blog just so I could load plugins to do this (of course, I haven’t posted anything to it yet, just let the plain-text formatting suffice on here).
That’s too cool…
Another wonderful feature! Thanks a bunch! 🙂
It seems like HTML tags above body content level (head, body, meta, doctype, style, …) are stripped out of the posting, which renders this feature’s use for HTML somewhat limited. Fix plz kthx 😉
brilliance. sheer brilliance…
Thank you!
shift+enter = : )
Thanks muchly!
This is really helpful, actually… despite the fact that I don’t write code.
Thanks for the tips.
I’m going to boo in here, since I cannot understand for the life of Brian why it has to take you over a year to accommodate the large group of developers, of which you are part, to make blogging easy for us. I have craved for this feature for so long where other blogs automattically have this from the start. Now on to free CSS and paid ‘other stuff’.
Holy cow! About the best update since, uhh…. when was your last post?
Thanks for working away on labour day with the post.
What a great feature! My blog doesn’t deal with programming, but this is a great tool for those blogs that do.
Thanks for your reply. I had a look at the so-called “open source” project listed, and the javascript there is all crushed up by some kind of compressor so that it’s virtually unreadable. Do you have a reference to the uncrushed javascript or a simple way to uncompress it? Otherwise adding a Perl mode isn’t really a practical job.
Oops, take that back, I found the uncompressed directory.
cool.. i really needed it
This is very cool.
It woud be nice if there was a way to have the pretty display but without colours, either for languages that it didn’t recognise or when I didn’t want to use syntax highlighting.
Outstanding! It looks great. Nice feature.
Very cool, it will come in handy! But even better than the source code is Shift + Enter! I’ve been dying for that some time now…
thanks
wh000t, god thank you for this (late, but now we have it *yeah*) feature.
I hated the “replace spaces with and never edit this post ever”-shit ;);)
this feature rules! (especially for my development-blog ^^ )
regards
ShoX
p.s.: Shift+Enter …. Why I didn´t try this earlier?! *d0h* 😀
It sould be posted long time ago. But thanks, one right step was made by wordpress.
Shift+Enter…… never been easier to write a “” : )
Will you add this to v2.3 please?
One warning, I tried using the XML tag to post some XAML.
DON’T!!! It butchered the XAML badly, stripped out half my tags. Fortunately I write all my posts in Word prior to putting in WordPress, so I was able to go back to the original.
If it works with some of the other languages though, it could make for an extremely nice experience for the blog reader, especially the ability to copy the code.
Arcane Code
Fantastic, it’ really make me do not want to leave from my laptop, event to rest room.
Thank you. YOu are really helping us.
Finally!!
thanks a lot for finally implementing this!!
Will this be on wp self-hosted version also? or do I need a plugin for that.
Cool!!!!
Thanks, this is a big step forward from wrangling pre and code tags. However (a), why no Perl (you’ve got Ruby and Python!), (b) no C++?, (c), which language is recommended as “most similar” to perl, to get the right syntax highlighting, and (d), thx for the Shift+Enter, but how about not throwing away my indentations?
Nice – but can you please add some generic source code type for languages not listed? I’m missing “shell” for example…
Thanks for that last tip 😉 it will be useful!
That’ll be helpful. Thanks!