authorgravatar for mcsinyx@disroot.orgNguyễn Gia Phong <mcsinyx@disroot.org> 2023-02-16 06:00:57+09:00
committergravatar for mcsinyx@disroot.orgNguyễn Gia Phong <mcsinyx@disroot.org> 2023-02-16 06:07:39+09:00
loge359308b2bf30f6fe5403ddfddcf7925f6ab1f7d
treecf8f6ed0bd542d9a6efd7339ada9b282c3eb708f
parent7199d7c77715fe06606c5c89595e6852b3fa8c20
signaturelock-open Commit is signed but in an unrecognized format.

autodoc: fix md list markers matching

Both original Markdown and CommonMark require at least one space or tab between the list marker and any following content. Following this allows starting a line with a negative number or one with a decimal point.

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

lib/docs/main.js+9-7
...@@ -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";
...@@ -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}