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 = {...@@ -3319,14 +3319,16 @@ const NAV_MODES = {
3319 } else if (line.text.startsWith("#")) {3319 } else if (line.text.startsWith("#")) {
3320 line.type = "h1";3320 line.type = "h1";
3321 line.text = line.text.substr(1);3321 line.text = line.text.substr(1);
3322 } else if (line.text.startsWith("-")) {3322 } else if (line.text.match(/^-[ \t]+.*$/)) {
3323 line.type = "ul";3323 // line starts with a hyphen, followed by spaces or tabs
3324 line.text = line.text.substr(1);3324 const match = line.text.match(/^-[ \t]+/);
3325 } else if (line.text.match(/^\d+\..*$/)) {
3326 // if line starts with {number}{dot}
3327 const match = line.text.match(/(\d+)\./);
3328 line.type = "ul";3325 line.type = "ul";
3329 line.text = line.text.substr(match[0].length);3326 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);
3330 line.ordered_number = Number(match[1].length);3332 line.ordered_number = Number(match[1].length);
3331 } else if (line.text == "```") {3333 } else if (line.text == "```") {
3332 line.type = "skip";3334 line.type = "skip";
...@@ -3536,7 +3538,7 @@ const NAV_MODES = {...@@ -3536,7 +3538,7 @@ const NAV_MODES = {
3536 case "ul":3538 case "ul":
3537 case "ol":3539 case "ol":
3538 if (3540 if (
3539 !previousLineIs("ul", line_no) ||3541 !previousLineIs(line.type, line_no) ||
3540 getPreviousLineIndent(line_no) < line.indent3542 getPreviousLineIndent(line_no) < line.indent
3541 ) {3543 ) {
3542 html += "<" + line.type + ">\n";3544 html += "<" + line.type + ">\n";
...@@ -3545,7 +3547,7 @@ const NAV_MODES = {...@@ -3545,7 +3547,7 @@ const NAV_MODES = {
3545 html += "<li>" + markdownInlines(line.text) + "</li>\n";3547 html += "<li>" + markdownInlines(line.text) + "</li>\n";
35463548
3547 if (3549 if (
3548 !nextLineIs("ul", line_no) ||3550 !nextLineIs(line.type, line_no) ||
3549 getNextLineIndent(line_no) < line.indent3551 getNextLineIndent(line_no) < line.indent
3550 ) {3552 ) {
3551 html += "</" + line.type + ">\n";3553 html += "</" + line.type + ">\n";
...@@ -4067,4 +4069,4 @@ function toggleExpand(event) {...@@ -4067,4 +4069,4 @@ function toggleExpand(event) {
4067 if (!parent.open && parent.getBoundingClientRect().top < 0) {4069 if (!parent.open && parent.getBoundingClientRect().top < 0) {
4068 parent.parentElement.parentElement.scrollIntoView(true);4070 parent.parentElement.parentElement.scrollIntoView(true);
4069 }4071 }
4070}
\ No newline at end of file
4072}