Skip to content

Audit should report a code fence that never closes #199

Closed

Description

@zibo-yang

With #171, the graph loader reads a fenced block that never closes as plain text, so the headings and links after it still count. That gives the correct dependency edge. It also means no tool reports the unclosed fence, while the published chapter page is still corrupted by it.

Found in the final review of #171 at 22d1c02 and reproduced there and on main at cc7e3a8.

Reproduction

A chapter c/ with three articles:

  • a.md: a statement, then a ```lean line with no closing fence, then ## Depends on with a link to z.md.
  • b.md: an ordinary article with a closed ```lean block.
  • z.md: any article.

Run autoform render, autoform check and autoform audit.

Observed

On the chapter page, the opener in a.md pairs with the closing fence in b.md. One code block swallows the end of Alpha's statement box, its dependency list and Beta's whole theorem box.

main #171
Graph edge c/a → c/z absent present
Rendered chapter page corrupted corrupted the same way
autoform check exit 0 exit 0
autoform audit on c/a.md missing-depends-section nothing

Before #171 the audit finding did not name the real problem, but it pointed the author at the file.

Expected

autoform audit names the article and says its fence never closes.

Suggested change

  • _mask_fences_and_comments in autoform_cli/markdown.py already detects the case when it rewinds to the fence's first line. Surface that as a new audit finding, for example unclosed-code-fence.
  • Correct the sentence in autoform_cli/README.md ("one that never closes is plain text on the page and hides no heading and no dependency link") and the docstring of mask_fences_and_comments. Both hold for a page with one article, not for a chapter page.
  • Test that the new code gives no finding on the bundled example, as the other audit codes added in Blueprint search and reuse: phase 1 items 1-3 and 5 (#143) #171 do.

This should land before the next release, because the README statement is inaccurate until it does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions