How To: Embedding Code Snippets

Here's how to embed code snippets into a Noteshell blog post.

Start by creating a new note and tag it with markdown and published.

Code can be either embedded directly or as a Github gist.

Embed a Code Snippet

Start and end a code block with three back-ticks: ``` on its own line.  Code can be pasted in between.

Here's an example of a rendered code block.

var s = "This is an alert";
alert(s);

Embed a Gist

  1. Go to https://gist.github.com and create a new public gist.
  2. Copy the entire gist ID from the top of the page as shown.
  3. Paste the value inside two square brackets beginning with a colon :.

Here's what the full gist embed code would look like using the gist ID shown in the image above.

[:gist:888882301a48fb527d30]