diff --git a/.agents/skills/docs-governance/scripts/markdown_links.py b/.agents/skills/docs-governance/scripts/markdown_links.py index 4a442e5e7..c9bb8e089 100644 --- a/.agents/skills/docs-governance/scripts/markdown_links.py +++ b/.agents/skills/docs-governance/scripts/markdown_links.py @@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool: def _continues_a_paragraph(text: str, line_start: int) -> bool: - """Whether the line at `line_start` follows a paragraph line, not a blank or list line.""" + """Whether the line at `line_start` follows a paragraph line. + + A blank line, a list or block quote line, and an indented line, which may continue a list + item, are not taken for one. + """ if line_start == 0: return False previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1] - return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous) + return ( + bool(previous.strip()) + and not previous[0].isspace() + and not CONTAINER_MARKER_RE.match(previous) + ) def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int: diff --git a/manifests/context-packs/skill-triggers@1.json b/manifests/context-packs/skill-triggers@1.json index feb2e300c..687b3769f 100644 --- a/manifests/context-packs/skill-triggers@1.json +++ b/manifests/context-packs/skill-triggers@1.json @@ -10,7 +10,7 @@ "id": "hand-seeded", "source": "manual-curation-pending-regeneration" }, - "registryDigest": "ccfb8409e8e2da6ca5666259da6d79fbcf3b68b37cb7920faf535315d3193b21", + "registryDigest": "2d1eadf78b62c0575bd0318696b9a81a385cd33af9b366b1b99085098ecb943e", "schemaVersion": 1, "triggers": { "skill:agent-runtime-gateway-smoke-test": [ diff --git a/pi/core/skills/docs-governance/scripts/markdown_links.py b/pi/core/skills/docs-governance/scripts/markdown_links.py index 4a442e5e7..c9bb8e089 100644 --- a/pi/core/skills/docs-governance/scripts/markdown_links.py +++ b/pi/core/skills/docs-governance/scripts/markdown_links.py @@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool: def _continues_a_paragraph(text: str, line_start: int) -> bool: - """Whether the line at `line_start` follows a paragraph line, not a blank or list line.""" + """Whether the line at `line_start` follows a paragraph line. + + A blank line, a list or block quote line, and an indented line, which may continue a list + item, are not taken for one. + """ if line_start == 0: return False previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1] - return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous) + return ( + bool(previous.strip()) + and not previous[0].isspace() + and not CONTAINER_MARKER_RE.match(previous) + ) def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int: diff --git a/skills/docs-governance/scripts/markdown_links.py b/skills/docs-governance/scripts/markdown_links.py index 4a442e5e7..c9bb8e089 100644 --- a/skills/docs-governance/scripts/markdown_links.py +++ b/skills/docs-governance/scripts/markdown_links.py @@ -74,11 +74,19 @@ def _is_escaped(text: str, index: int) -> bool: def _continues_a_paragraph(text: str, line_start: int) -> bool: - """Whether the line at `line_start` follows a paragraph line, not a blank or list line.""" + """Whether the line at `line_start` follows a paragraph line. + + A blank line, a list or block quote line, and an indented line, which may continue a list + item, are not taken for one. + """ if line_start == 0: return False previous = text[text.rfind("\n", 0, line_start - 1) + 1 : line_start - 1] - return bool(previous.strip()) and not CONTAINER_MARKER_RE.match(previous) + return ( + bool(previous.strip()) + and not previous[0].isspace() + and not CONTAINER_MARKER_RE.match(previous) + ) def _html_comment_end(text: str, start: int, closing: int, blank: int) -> int: diff --git a/tests/test_docs_governance_audit.py b/tests/test_docs_governance_audit.py index ac5bd6951..8527f267e 100644 --- a/tests/test_docs_governance_audit.py +++ b/tests/test_docs_governance_audit.py @@ -298,6 +298,7 @@ def test_artifact_scope_reads_html_comments_as_commonmark_does(project: Path) -> # -- a list that starts at 2 cannot interrupt a paragraph; one that starts at 1 can -- "Paragraph\n2. [numbered](missing-numbered.md)\n\n" "1. first\n2. [listed2](missing-listed2.md)\n\n" + "1. first\n continued\n2. [listed3](missing-listed3.md)\n\n" "Paragraph\n1. [one](missing-one.md)\n\n" # -- after text in a list item, a comment is inline again -- "- item \n\n" @@ -324,6 +325,7 @@ def test_artifact_scope_reads_html_comments_as_commonmark_does(project: Path) -> assert "Broken Markdown link: 'guide.md' -> 'missing-item-real.md'" in result.stdout assert "Broken Markdown link: 'guide.md' -> 'missing-numbered.md'" in result.stdout assert "missing-listed2.md" not in result.stdout + assert "missing-listed3.md" not in result.stdout assert "missing-one.md" not in result.stdout assert "missing-definition.md" not in result.stdout assert "Broken Markdown link: 'guide.md' -> 'missing-titled.md'" in result.stdout