Markdown – Embedding Code Snippets In Code Snippet

When tried to show how to insert code snippets in markdown, I found that I didn’t know how to insert code sinppets in code snippet.

Helped by Google, I finally got the solution.

We can embed code snippets into Markdown text by:

  1. intending 4 or more spaces, or a tab as code block
  2. using triple backticks plus a syntax language code delimiter at the beginning and triple backticks at the end of code block

Interactive use of the two ways can help us write a demo of inserting code in markdown. Continue reading

How To Insert Code Snippets in Blogger Post

There’s no native way to insert codes in Blogger (ie – no button on the editor toolbar). However we can manage to overcome the problem.

The easiest way is to write the full content in markdown and then copy it into the blog editor. It comes with full syntax highlighting in the language of your choice.

For example, we can write java code like this:

And the result:

Continue reading