How to add Code Snippets in Blogger Post

If you want to highlight your code just like this in blogger post then you are in the right place.

var name = "Jhon",
    email = "",
    cnic = "111-222-333",
    course1 = new Course('CS401', 'Web Development'),
    course2 = new Course('CS402', 'Machine Learning'),
    phoneNumber = new PhoneNumber(1, 718, 1112223),
    address = new Address('House# 1', 'Albion', 'New York', 'USA', phoneNumber);

In this tutorial, I will discuss the easiest way to add code snippets with highlighted syntax in blogger post which I'm also using.

Step 1: Go to HILITE.

Step 2: Paste your code in the Source code text area.

Step 3: Select your code language, a style that you want to use for highlighting and select the checkbox if you want line numbers. I have selected javascript as I have pasted javascript code and colorful style.

Step 4: Click the highlight button.

Step 5: Copy your generated HTML.

Step 6: Go to your Blog Post HTML and paste it where you want to add Highlighted Code.

No comments