1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

add code block line numbering option to

This commit is contained in:
Rokt33r
2016-05-04 00:47:22 +09:00
parent 831bec5baf
commit f904fd00e5
6 changed files with 36 additions and 19 deletions

View File

@@ -3,14 +3,14 @@ import emoji from 'markdown-it-emoji'
import math from '@rokt33r/markdown-it-math'
import hljs from 'highlight.js'
var createGutter = function (str) {
var lc = (str.match(/\n/g) || []).length;
var lines = [];
for (var i = 1; i <= lc; i++) {
lines.push('<span>' + i + '</span>');
function createGutter (str) {
let lc = (str.match(/\n/g) || []).length
let lines = []
for (let i = 1; i <= lc; i++) {
lines.push('<span>' + i + '</span>')
}
return '<span>' + lines.join('') + '</span>';
};
return '<span class="lineNumber">' + lines.join('') + '</span>'
}
var md = markdownit({
typographer: true,