How to insert source code in Google Docs or WordPress

For Google Docs like document, go to this website: input what you want and select the proper language. The output is colored with nice style. Simply copy them into your document.

For wordpress, just wrap your code with tag

To accomplish the above, just wrap your code in these tags "sourcecode" directly in the “visual” edit interface (HTML is not necessary), most common languages are supported, like java, php, python, etc. The attributes for this tag are: language, For more:

A sample:

package org.myorg;

public class test {

    public static void main(String[] args) throws Exception {
        String arg = "Hello World!";

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s