Skip to content

Doc-example gate cannot see indented or blockquoted fences, so those examples are silently unchecked #946

Description

@Nitjsefnie

Describe the bug

tests/test_doc_examples.py recognises a fence only at column zero:

tests/test_doc_examples.py:31
FENCE = re.compile(r"^```(\S*)\s*(\S*)\s*$")

Markdown allows a fenced block to be indented, or nested inside a blockquote or list item, and such a block is valid and renders normally on GitHub. The gate cannot see any of those, so an example written that way is never executed or compared — silently, with no diagnostic.

To reproduce

A document containing one ordinary top-level example plus a second example nested in a blockquote:

```eigenscript
marked
```
```output
marked
```

> ```eigenscript
> error
> ```
> ```output
> should-not-be-ignored
> ```

The gate reports one checked example and exits 0. The blockquoted example is not run, so its output is never compared and drift in it is invisible.

Expected behavior

Either indented and nested fences are recognised and checked like any other, or an unrecognised-but-plausible example fence is reported so an author knows the block is not covered. Silence is the problem — the document looks gated when part of it is not.

Actual behavior

Nested and indented examples are invisible to the gate and produce no output at all.

Environment

  • OS: Ubuntu 24.04
  • GCC version: 13.2
  • EigenScript version: built from main at the time of filing

Found while extending this gate to cover README examples (#934). The parser predates that work and is untouched by it. Worth noting the interaction: with per-file coverage counting, a document whose only example is nested now fails with a zero-coverage error, which is the safe direction — the gap is a document that has one valid pair plus a nested one.

Whether nested examples should be supported at all is a judgement call about how the docs are written, which is why this is a report rather than a patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions