Added back missing list item custom parsing

This commit is contained in:
Wu Cheng-Han 2015-09-25 18:10:36 +08:00
parent fa957db272
commit 4e358cd6f4
2 changed files with 11 additions and 2 deletions

View file

@ -429,8 +429,8 @@ var md = new Remarkable('full', {
typographer: true, typographer: true,
highlight: highlightRender highlight: highlightRender
}); });
md.renderer.rules.list_item_open = function (/* tokens, idx, options, env */) { md.renderer.rules.list_item_open = function ( /* tokens, idx, options, env */ ) {
return '<li class="raw">'; return '<li class="raw">';
}; };
md.renderer.rules.blockquote_open = function (tokens, idx /*, options, env */ ) { md.renderer.rules.blockquote_open = function (tokens, idx /*, options, env */ ) {
return '<blockquote class="raw">\n'; return '<blockquote class="raw">\n';

View file

@ -31,6 +31,15 @@ md.renderer.rules.bullet_list_open = function (tokens, idx /*, options, env */ )
return '<ul>\n'; return '<ul>\n';
}; };
md.renderer.rules.list_item_open = function (tokens, idx /*, options, env */ ) {
if (tokens[idx].lines) {
var startline = tokens[idx].lines[0] + 1;
var endline = tokens[idx].lines[1];
return '<li class="raw" data-startline="' + startline + '" data-endline="' + endline + '">\n';
}
return '<li class="raw">';
};
md.renderer.rules.ordered_list_open = function (tokens, idx /*, options, env */ ) { md.renderer.rules.ordered_list_open = function (tokens, idx /*, options, env */ ) {
var token = tokens[idx]; var token = tokens[idx];
if (tokens[idx].lines && tokens[idx].level === 0) { if (tokens[idx].lines && tokens[idx].level === 0) {