|
|
|
@ -219,6 +219,19 @@ Renderer.prototype.renderToken = function renderToken(tokens, idx, options) { |
|
|
|
// Add token name, e.g. `<img`
|
|
|
|
result += (token.nesting === -1 ? '</' : '<') + token.tag; |
|
|
|
|
|
|
|
// Add source line number attribute in order to allow sync scrolls
|
|
|
|
// Idea extracted from (https://markdown-it.github.io/index.js)
|
|
|
|
if (options.lineNumber) { |
|
|
|
if (token.map && token.level === 0) { |
|
|
|
var attr = [ 'data-line', token.map[0] ]; |
|
|
|
if (token.attrs) { |
|
|
|
token.attrs.push(attr); |
|
|
|
} else { |
|
|
|
token.attrs = [ attr ]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Encode attributes, e.g. `<img src="foo"`
|
|
|
|
result += this.renderAttrs(token); |
|
|
|
|
|
|
|
|