authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-02-20 16:33:00+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-02-20 16:33:00+01:00
logdfd182cc7a831ec75ccc03792afd27b292db194b
tree9498355e09b732f39e6142b750ecfec55abd0055
parent476bdc8b0b02cbd09f6a856aa7dc548dea565109
parentb56d4f215061e57dd2f5470c14df0c27b810c8ba
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #14655 from McSinyx/md-ol

autodoc: fix markdown list rendering

1 files changed, 11 insertions(+), 9 deletions(-)

lib/docs/main.js+11-9
......@@ -3319,14 +3319,16 @@ const NAV_MODES = {
33193319 } else if (line.text.startsWith("#")) {
33203320 line.type = "h1";
33213321 line.text = line.text.substr(1);
3322 } else if (line.text.startsWith("-")) {
3323 line.type = "ul";
3324 line.text = line.text.substr(1);
3325 } else if (line.text.match(/^\d+\..*$/)) {
3326 // if line starts with {number}{dot}
3327 const match = line.text.match(/(\d+)\./);
3322 } else if (line.text.match(/^-[ \t]+.*$/)) {
3323 // line starts with a hyphen, followed by spaces or tabs
3324 const match = line.text.match(/^-[ \t]+/);
33283325 line.type = "ul";
33293326 line.text = line.text.substr(match[0].length);
3327 } else if (line.text.match(/^\d+\.[ \t]+.*$/)) {
3328 // line starts with {number}{dot}{spaces or tabs}
3329 const match = line.text.match(/(\d+)\.[ \t]+/);
3330 line.type = "ol";
3331 line.text = line.text.substr(match[0].length);
33303332 line.ordered_number = Number(match[1].length);
33313333 } else if (line.text == "```") {
33323334 line.type = "skip";
......@@ -3536,7 +3538,7 @@ const NAV_MODES = {
35363538 case "ul":
35373539 case "ol":
35383540 if (
3539 !previousLineIs("ul", line_no) ||
3541 !previousLineIs(line.type, line_no) ||
35403542 getPreviousLineIndent(line_no) < line.indent
35413543 ) {
35423544 html += "<" + line.type + ">\n";
......@@ -3545,7 +3547,7 @@ const NAV_MODES = {
35453547 html += "<li>" + markdownInlines(line.text) + "</li>\n";
35463548
35473549 if (
3548 !nextLineIs("ul", line_no) ||
3550 !nextLineIs(line.type, line_no) ||
35493551 getNextLineIndent(line_no) < line.indent
35503552 ) {
35513553 html += "</" + line.type + ">\n";
......@@ -4067,4 +4069,4 @@ function toggleExpand(event) {
40674069 if (!parent.open && parent.getBoundingClientRect().top < 0) {
40684070 parent.parentElement.parentElement.scrollIntoView(true);
40694071 }
4070}
\ No newline at end of file
4072}