How To Embed Code Into Your Blog

When I first started this blog, I was completely lost on how to properly embed code. Luckily, someone commented on one of my posts and told me I need to embed my code between the “[ sourcecode language = “css” ]” and “[ /sourcecode ]” tags. It seemed to be working ok, but I kept wondering why the language was css, when I was working with Java and now Ruby. Also, the formatting wasn’t quite right, especially for Ruby # comments.

The other day, I tried experimenting with the tages, by embedding my ruby code between the “[ sourcecode language = “ruby”]” and “[ /sourcecode]”  tags. Lo and behold, this worked perfectly! My code is now property formatted for Ruby specifically, just like it is in my TextMate text editor. I really wish I tried this earlier, but it’s never too late. So if you’re embedding code into your blog, make sure to play around with the language in the sourcecode tag 🙂

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.