mirror of
https://github.com/dragonish/obsidian-heading-decorator.git
synced 2026-07-22 12:20:29 +00:00
fix(heading): fix unordered list mistakenly identified as level 2 heading
This commit is contained in:
parent
026468cba8
commit
e2ea114bcd
2 changed files with 10 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ export class Heading {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (/^(?:>|[ ]{4,}|\t)/.test(lineText)) {
|
||||
if (/^(?:>|[ ]{4,}|\t|\s*[-*]\s+)/.test(lineText)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,5 +127,14 @@ describe("common/heading", function () {
|
|||
expect(heading5.handler(4, "==")).to.equal(-1);
|
||||
expect(heading5.handler(5, " This is a heading 1", "==")).to.equal(-1);
|
||||
expect(heading5.handler(6, "==")).to.equal(-1);
|
||||
|
||||
const heading6 = new Heading();
|
||||
expect(heading6.handler(1, "- item a", "\t- item b")).to.equal(-1);
|
||||
expect(heading6.handler(2, "\t- item b", "- item c")).to.equal(-1);
|
||||
expect(heading6.handler(3, "- item c", "-")).to.equal(-1);
|
||||
expect(heading6.handler(4, "-", "")).to.equal(-1);
|
||||
expect(heading6.handler(5, "", "Heading 2")).to.equal(-1);
|
||||
expect(heading6.handler(6, "Heading 2", "-")).to.equal(2);
|
||||
expect(heading6.handler(7, "-", "")).to.equal(-1);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue