Read the blog

Dr. Jones

Posted on October 8, 2016 6:46 AM, Markdown

Read the blogpost about this blog :)

Blog post

Here's the complete source code on github

And here's the Markdown code for this blog post:

### Read the blogpost about this blog :)
[Blog post](!posts/57f388a0a5631e2a0000071e)

Here's the complete source code on [github](

And here's the Markdown code for this blog post:

Tables in Markdown


Posted on October 5, 2016 7:18 PM, Markdown

Tables are supported in Markdown. The syntax is esoteric but effective.

A table:

Col 1Col 2Col 3

The markup for the markdown:

    | Col 1 | Col 2 | Col 3 |
    | ---  | :---: | ---: |
    | Left | Center | Right |

Markdown in 60 seconds

Dr. Jones

Posted on October 5, 2016 7:12 PM, Tech Markdown

Markdown is just plain text which follows the Markdown language.

The Hello World code in Markdown:

# Hello world!
A paragraph in a markdown element

Learn markdown in 60 seconds here:

Code highlightning


Posted on October 4, 2016 12:48 PM, Markdown JavaScript

Writing tecnical articles with a lot of code examples or docs is a sweet spot for Markdown. Having the code syntax highlighted is a nice feature that adds readability to your text.

The exellent library enables easy code hightligning inside code blocks in Markdown. Just add the language name after the 3 backticks.

This code:

    var x = 42;

Will render a html which enables the library to highlight the code:

<pre><code class="language-javascript">
var x = 42;

Including prism.js

Download the CSS and JavaScript files from prism.js and include them in you project.


Handlebars Markdown helper

Dr. Jones

Posted on October 4, 2016 12:24 PM, Tech Handlebars

In order to render an item from the database as Markdown it must be transformed from plain text to valid HTML.

The {{markdown}} helper renders the input variable as HTML, or if used with {{#markdown}} ... {{/markdown}} it renders the body Markdown text from inside the tag.

If we load some items from the database we can pass it to the Markdown helper like this.

    "items": {
        "collection": "blogposts",
        "query": {"published": true},
        "hint": {"$orderby": {"publishdate": -1}}
{{#each item}}
    {{{markdown this.content}}}

Note the 3 {{{ around the markdown tag, it's necessary to escape the HTML output from the Markdown tag into the page.

The source

Dr. Jones

Posted on October 3, 2016 7:25 PM, Handlebars Markdown

The source code for this page:

    "posts": {
        "collection": "blogposts",
        {{#if request.query.searchterm}}
            "query": {"published": true,"_tags": {"$regex": "{{_ "replace" request.query.searchterm " " "|"}}"}},
            "query": {"published": true},
        "hint": {"$orderby": {"publishdate": -1}}
    "category": {
        "collection": "category",
        "query": {}
{{#inherit 'masterpage'}}
{{#block 'blogposts'}}
    {{#each posts}}
        <p class="lead">
            <img class="profileimg" src="/media/{{}}"> <a href="#">{{}}</a>
        <p><span class="glyphicon glyphicon-time"></span> Posted on {{moment publishdate format="LLL"}}, 
        {{#each categories}}
            <span class="label label-default">{{name}}</span>
        <p>{{{markdown content}}}</p>
        <hr class="blogsep">

Blog Search

About Markdown

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).