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
signature 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 = {
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";
......@@ -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}