mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
fix: list item tag (#139)
This commit is contained in:
parent
c92c454cea
commit
7d1a8d5644
@ -136,22 +136,22 @@ class WxRenderer {
|
|||||||
renderer.codespan = (text, lang) =>
|
renderer.codespan = (text, lang) =>
|
||||||
`<code ${getStyles("codespan")}>${text}</code>`;
|
`<code ${getStyles("codespan")}>${text}</code>`;
|
||||||
renderer.listitem = (text) =>
|
renderer.listitem = (text) =>
|
||||||
`<span ${getStyles(
|
`<li ${getStyles(
|
||||||
"listitem"
|
"listitem"
|
||||||
)}><span style="margin-right: 10px;"><%s/></span>${text}</span>`;
|
)}><span><%s/></span>${text}</li>`;
|
||||||
|
|
||||||
renderer.list = (text, ordered, start) => {
|
renderer.list = (text, ordered, start) => {
|
||||||
text = text.replace(/<\/*p.*?>/g, "");
|
text = text.replace(/<\/*p.*?>/g, "");
|
||||||
let segments = text.split(`<%s/>`);
|
let segments = text.split(`<%s/>`);
|
||||||
if (!ordered) {
|
if (!ordered) {
|
||||||
text = segments.join("•");
|
text = segments.join("• ");
|
||||||
return `<p ${getStyles("ul")}>${text}</p>`;
|
return `<ul ${getStyles("ul")}>${text}</ul>`;
|
||||||
}
|
}
|
||||||
text = segments[0];
|
text = segments[0];
|
||||||
for (let i = 1; i < segments.length; i++) {
|
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) => {
|
renderer.image = (href, title, text) => {
|
||||||
let subText = "";
|
let subText = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user