Skip to content

Commit

Permalink
fix: list item tag (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme authored Mar 16, 2022
1 parent c92c454 commit 7d1a8d5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/assets/scripts/renderers/wx-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,22 @@ class WxRenderer {
renderer.codespan = (text, lang) =>
`<code ${getStyles("codespan")}>${text}</code>`;
renderer.listitem = (text) =>
`<span ${getStyles(
`<li ${getStyles(
"listitem"
)}><span style="margin-right: 10px;"><%s/></span>${text}</span>`;
)}><span><%s/></span>${text}</li>`;

renderer.list = (text, ordered, start) => {
text = text.replace(/<\/*p.*?>/g, "");
let segments = text.split(`<%s/>`);
if (!ordered) {
text = segments.join("•");
return `<p ${getStyles("ul")}>${text}</p>`;
text = segments.join("• ");
return `<ul ${getStyles("ul")}>${text}</ul>`;
}
text = segments[0];
for (let i = 1; i < segments.length; i++) {
text = text + i + "." + segments[i];
text = text + i + ". " + segments[i];
}
return `<p ${getStyles("ol")}>${text}</p>`;
return `<ol ${getStyles("ol")}>${text}</ol>`;
};
renderer.image = (href, title, text) => {
let subText = "";
Expand Down

0 comments on commit 7d1a8d5

Please sign in to comment.