Skip to content

Commit

Permalink
feat: enforce --- to be at the front of the line, optionally preceded…
Browse files Browse the repository at this point in the history
… by spaces/tabs
  • Loading branch information
revelt committed Aug 30, 2022
1 parent 8f752ba commit 7d9696f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/seo-editor/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function editor(todo = "", copy = ""): Res {
let start = Date.now();

let chunksArr = copy
.split(/---+/)
.split(/^[ \t]*---+/m)
.map((ch) => prepChunk(ch).toLowerCase())
.filter((ch) => ch.trim());
DEV &&
Expand Down
16 changes: 16 additions & 0 deletions packages/seo-editor/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,20 @@ test(`07 - nothing todo`, () => {
);
});

test(`08 - three dashes in the text`, () => {
equal(
prep(
editor(
`
- a
- b
- c`,
"some text `---` like this"
)
).chunkWordCounts.length,
1,
"08"
);
});

test.run();

0 comments on commit 7d9696f

Please sign in to comment.