showdown.js extension for rendering markflat flavored markdown
npm install takb/markflat.showdown
const showdown = require('showdown');
require('markflat.showdown');
var converter = new showdown.Converter({ extensions: ['markflat'] });
converter.makeHtml("# Title - Artist\n1. first verse {F} lyrics\n~Chorus {a7}lyrics of {C}chorus")
/* output:
<h1 id="titlespanclassmbartistartistspan">
Title<span class="mb-artist"> - Artist</span>
</h1>
<ol>
<li class="mb-has-chords">
first verse <span class="mb-ca"><span class="mb-chord">F</span> </span>lyrics
</li>
</ol>
<ul>
<li class="mb-has-chords" list="Chorus">
<span class="mb-ca"><span class="mb-chord">a<sup>7</sup></span>l</span>yrics of <span class="mb-ca"><span class="mb-chord">C</span>c</span>horus
</li>
</ul>
*/
- mbZoom (default:
100
)
Zoom factor in %. If mbEnableZoom is set to true, prepends CSS style tag withfont-size: [mbZoom]%;
to converted html. - mbEnableZoom (default:
false
) - mbTransposeBy (default:
0
)
Number of transpose steps (-12 - +12). Requires mbTranspose to be a function that relies on this value. - mbTranspose
Function to transpose the key of all chords in the document. Set only if you need to custmize the transposition function. - mbAddMinorChordMarker (default:
false
)
Iftrue
, adds charcter 'm' to minor chords ('a7' => 'am7'). - mbAddStyle (default:
false
)
Iftrue
, prepends CSS style tag with styling form mbStyle to converted html. - mbStyle
The CSS style string. Change to customize how converted HTML is rendered.
Example:
var converter = new showdown.Converter({
extensions: ['markflat'],
mbEnableZoom: true,
mbAddStyle: true
});