Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pstack/skills/poteto-mode/scripts/check-plan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ for (let i = start; i < raw.length; i++) {
lines.push({ n, text, code });
if (code) continue;
const prose = text
.replace(/`[^`]*`/g, "`")
.replace(/(?<!`)(`+)(?!`)(.*?)(?<!`)\1(?!`)/g, "`")
.replace(/!\[[^\]]*\]\([^)]*\)/g, "")
.replace(/\]\([^)]*\)/g, "]");
if (/[\u2013\u2014]/.test(prose)) fail(n, "long dash");
Expand Down
14 changes: 14 additions & 0 deletions pstack/skills/poteto-mode/scripts/check-plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,17 @@ test("rejects backtick info strings containing a backtick", () => {
const result = runPlan("```markdown `invalid`\n## Example only\n```\n", 1);
expect(result.stderr).toContain('"## Example only" after Close the program is not an appendix');
});

test("ignores prose punctuation inside matching multi-backtick code spans", () => {
for (const count of [2, 3, 4]) {
const delimiter = "`".repeat(count);
runPlan(`Use ${delimiter}echo \`x\`: “quoted” — example${delimiter}.\n`, 0);
}
});

test("checks prose following a multi-backtick span and unmatched delimiters", () => {
const outside = runPlan("Use ``echo `x`: y``. Bad: prose.\n", 1);
expect(outside.stderr).toContain("mid-sentence colon");
const unmatched = runPlan("Use ``unclosed: bad` here.\n", 1);
expect(unmatched.stderr).toContain("mid-sentence colon");
});