Tuesday, August 17, 2021

Blogging: Embed code in blogger/blogpost

Some plain text here.

Below is the code to be added in bolg

       
       

package java8;

import java.util.*;

public class SampleCode {

	public static void main(String[] args) {
		/*
		 * String abc = "abc";
		System.out.println("String abc :"+abc);
		 */
		
		String abc = "abc";
		System.out.println("String abc :"+abc);
		List<Integer> list = Arrays.asList(1, 2, 3, 4, 5); 
		for(int j: list) {
			System.out.println("Hi "+j);
		}
	}
}

Then again some text

Again some code to embed

       
       

package java8;

import java.util.*;

public class SampleCode {

	public static void main(String[] args) {
		/*
		 * String abc = "abc";
		System.out.println("String abc :"+abc);
		 */
		
		String abc = "abc";
		System.out.println("String abc :"+abc);
		List<Integer> list = Arrays.asList(1, 2, 3, 4, 5); 
		for(int j: list) {
			System.out.println("Hi "+j);
		}
	}
}


How to do it? Follow the below steps

1. Get your code and convert it for syntax highlighting using http://tohtml.com/

2.  Copy the converted syntax to Clipboard (there is button for that)

3. Add below lines in you HTML view, where you want to add the code

<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; 

                color: #000000; background-color: #eee;

                font-size: 12px; border: 1px dashed #999999;

                line-height: 14px; padding: 5px; 

                overflow: auto; width: 100%">

       <code style="color:#000000;word-wrap:normal; width: 100%">

            <<<<<<<Copy contents from clipboard here>>>>>>>

</code></pre>

4. You are done...!!!

No comments:

SpringBoot: Features: SpringApplication

Below are a few SpringBoot features corresponding to SpringApplication StartUp Logging ·          To add additional logging during startup...