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.

4 changes: 2 additions & 2 deletions pstack/skills/poteto-mode/scripts/check-plan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ if (raw[0] === "---") {
const lines = [];
let fence = null;
const openingFence = (text) => {
const match = text.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);
const match = text.match(/^[ \t]*(`{3,}|~{3,})(.*)$/);
if (!match || (match[1][0] === "`" && match[2].includes("`"))) return null;
return { char: match[1][0], length: match[1].length };
};
const closingFence = (text, opening) => {
const match = text.match(/^ {0,3}(`+|~+)[ \t]*$/);
const match = text.match(/^[ \t]*(`+|~+)[ \t]*$/);
return Boolean(
match &&
match[1][0] === opening.char &&
Expand Down
13 changes: 13 additions & 0 deletions pstack/skills/poteto-mode/scripts/check-plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ test("accepts ordinary, indented, and longer closing fences", () => {
runPlan("```markdown\n## Example only\n````\n", 0);
});

test("treats fences inside nested list items as code", () => {
const body = "## Example only\nThis prose has a mid-sentence colon: inside code\n- [ ] Not a box.\n";
for (const indent of [" ", " ", "\t"]) {
const indented = body.replace(/^/gm, indent);
runPlan(`- [ ] Outer.\n - [ ] Inner.\n\n${indent}\`\`\`yaml\n${indented}${indent}\`\`\`\n`, 0);
}
});

test("checks prose after a fence inside a nested list item", () => {
const result = runPlan("- [ ] Outer.\n - [ ] Inner.\n\n ```yaml\n retry: 3\n ```\nThis prose has a mid-sentence colon: bad.\n", 1);
expect(result.stderr).toContain("mid-sentence colon");
});

test("accepts nested backticks and tilde info strings", () => {
runPlan("````markdown\n```markdown\n## Example only\n```\n````\n", 0);
runPlan("~~~markdown `info`\n## Example only\n ~~~\n", 0);
Expand Down