Examples

Embedded images

  • The following online PNG image in your markdown source will be embedded in the generated html Homer Simpson

  • The following local PNG image in your markdown source will be embedded in the generated html Homer Simpson

  • The following local SVG icon in your markdown source will be embedded in the generated html Painting

Some text with LaTeX-like formulae using KaTeX

Surround your LaTeX with a single $ on each side for inline rendering. Use two $ for block rendering. This mode uses bigger symbols and centres the result.

This is an inline LaTeX-like formula c=memodnc=m^e \mod n describing textbook RSA encryption.

And this is a block formula:

f(x)=f^(ξ)e2πiξxdξf(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi

Highlighted code

The following code will be highlighted with highlight.js. Default style is 'vs2015' but you can choose any highlight.js style passing the name to the command with --highlightjs-style <stylename>.

'use strict'

const mdChords = require('markdown-it')({ breaks: true }).use(require('markdown-it-chords'))

module.exports = function chords (md) {
  const defaultRender = md.renderer.rules.fence

  md.renderer.rules.fence = function (tokens, idx, options, env, self) {
    const token = tokens[idx]

    if (token.tag === 'code' && token.info === 'song') {
      return `<div class="song">${mdChords.render(token.content)}</song>`
    }

    // pass token to default renderer.
    return defaultRender(tokens, idx, options, env, self)
  }
}

Song lyrics with chords

You can also render songs (lyrics with chords) using chordsong or markdown-it-chords.

Rendering a song involves writting it a a fenced code block with language set to :

A song using chordsong

Lucía
Rosario
Joan Manuel Serrat
4th fret
4/4 83 bpm
Am Am Vuela esta canción
Am/C Am/C Bm7b5 Bm7b5 para ti, Lucía,
Eaug Eaug E7 E7 Am Am Asus2/G Asus2/G la más bella historia de amor
Dm6/F Dm6/F E7sus4 E7sus4 E7 E7 que tuve y tendré.

A song using markdown-it-chords

CDo, a deer, a female deer
DmRay, a drop of golden sun
E♭May, a possiD♯bility
D/F♯Fee, the price you pay to run