Programming

How To: Put Code in Your Blog without Losing Formatting EASY

Do you want to post your code to your blog without it looking like a jumbled mess? Do you want to put code snippets without ruining your precious formatting while also being colorful and easy to be read? Well now you can!

So you have tried coding and now you want to share your code online. Now you decide to post your code on your blog only to realize that your code that you have aesthetically made is now jumbled up by your blogging platform like this:

 

DONT WORRY! There are two EASY ways to fix it! And guess what, it is both FREE!!

First by using GitHub’s Gist service (FREE for GitHub users), or by using the HTML method provided by hilite.me (FREE for the public).

Method 1: Embedding the code from GitHub Gist

Simply use github’s free service gist! https://gist.github.com/

The code will now look like this:

Method 2: Getting the HTML formatting of your code from hilite.me

If you don’t have a Github account, dont worry there is a free alternative that is actually more flexible than GitHub’s service called hilite.me
Instead of embedding GitHub, this method creates an HTML version of your code.

The code will now look like this:

1
2
3
4
5
6
7
8
public class HelloWorld {

    public static void main(String[] args) {
        
        System.out.println("Hello, World");
    }

}

 


As you can see, both of them can be copy pasted easily and can be read with ease!

Leave a Reply

Your email address will not be published. Required fields are marked *