Add support for markdown-style headlines (lines beginning with #)
endpush = '</li>';
}
- // Create headers when lines begin with =
- if (l[0] == '=') {
- var m = l.match(/^(=+)/);
+ // Create headers when lines begin with = or #
+ if (l[0] == '=' || l[0] == '#') {
+ var m = l.match(/^([=#]+)/);
var depth = m[1].length;
if (depth <= 5) {
- l = l.replace(/^=+\s*/, '').replace(/\s*=+$/, '');
+ l = l.replace(/^[=#]+\s*/, '').replace(/\s*[=#]+$/, '');
out.push('<h' + depth + '>');
endpush = '</h' + depth + '>';
}