Skip to content

Commit

Permalink
Merge pull request #17 from nekocode/ol
Browse files Browse the repository at this point in the history
Add support for ordered list
  • Loading branch information
lyricat authored Apr 14, 2019
2 parents 397f32e + 94aa871 commit b56e6b1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/assets/scripts/renderers/wx-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,19 @@ var WxRenderer = function (opts) {
return '<code ' + S('codespan') + '>' + text + '</code>'
}
renderer.listitem = function (text) {
return '<span ' + S('listitem') + '><span style="margin-right: 10px;">•</span>' + text + '</span>'
return '<span ' + S('listitem') + '><span style="margin-right: 10px;"><%s/></span>' + text + '</span>';
}
renderer.list = function (text, ordered, start) {
var segments = text.split('<%s/>');
if (!ordered) {
return '<p ' + S('ul') + '>' + text + '</p>'
text = segments.join('•');
return '<p ' + S('ul') + '>' + text + '</p>';
}
return '<p ' + S('ol') + '>' + text + '</p>'
text = segments[0];
for (var i = 1; i < segments.length; i++) {
text = text + i + '.' + segments[i];
}
return '<p ' + S('ol') + '>' + text + '</p>';
}
renderer.image = function (href, title, text) {
return '<img ' + S(ENV_STETCH_IMAGE ? 'image' : 'image_org') + ' src="' + href + '" title="'+title+'" alt="'+text+'"/>'
Expand Down

0 comments on commit b56e6b1

Please sign in to comment.