Skip to content

Recognize YAML front matter and exclude it from prose checks - #27

Merged
Malcolmnixon merged 1 commit into
mainfrom
feat/frontmatter-recognition
Sep 29, 2026
Merged

Malcolmnixon merged 1 commit into
mainfrom
feat/frontmatter-recognition

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Pull Request

Description

Adds detection of a leading YAML front matter block - the convention used by Jekyll, Hugo, and
Pandoc - and excludes it entirely from prose checks. A document's literal first line of ---,
closed by a later --- or ..., marks the block; everything between the delimiters is skipped
rather than checked as prose.

Front matter holds document metadata (titles, author names, keywords), not technical prose.
Checking it as prose previously produced false-positive findings against placeholder names and
keywords, and could suggest nonsensical "corrections" to metadata values.

The opening delimiter must be the document's literal first line, so a --- line appearing
elsewhere (for example, a horizontal rule) is never misidentified as front matter. A first line
of --- with no closing delimiter anywhere in the document falls back to being treated as
ordinary paragraph content, matching the same Jekyll/Hugo/Pandoc convention for that edge case,
rather than silently discarding the rest of the document.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

Closes #

Pre-Submission Checklist

Build and Test

  • Code builds successfully and all tests pass: pwsh ./build.ps1 - 1344/1344 passed
  • Code produces zero warnings

Code Quality

  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

  • All linters pass: pwsh ./lint.ps1 - clean

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable) - no schema/behavior text referenced front matter; none needed
  • Updated docs/ documentation (if applicable) - design, verification, and reqstream artifacts updated
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable) - added Ste100Mark-Linting-FrontMatter, linked from Ste100Mark-System-Lint

Additional Notes

Scoped to detection/exclusion only; this does not add a config flag to disable the behavior,
since front matter simply is not prose, matching how the tools that popularized this convention
(Jekyll, Hugo, Pandoc) treat it unconditionally.

Adds detection of a leading YAML front matter block (the convention
used by Jekyll, Hugo, and Pandoc): a document's literal first line
of '---', closed by a later '---' or '...'. Content between the
delimiters is skipped entirely rather than treated as prose, so
metadata such as titles, author names, and keywords is never checked
against STE100 rules.

The opening delimiter must be the document's literal first line, so
a '---' line elsewhere in the document (for example, a horizontal
rule) is never misidentified as front matter. A first line of '---'
with no closing delimiter anywhere in the document falls back to
being treated as ordinary paragraph content, matching the same
Jekyll/Hugo/Pandoc convention for that edge case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 29, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation, tests, and supporting documentation are complete; the remaining traceability nit is minor.

Review effort: Lite
Findings: None

What changed in this PR

Adds YAML front matter detection to exclude metadata from Markdown prose linting while preserving source line numbers.

Changes:

  • Implements ---/... front matter detection and safe fallback behavior.
  • Adds extractor and linter tests.
  • Updates design, verification, and requirements documentation.
File Summary
test/​DemaConsulting.Ste100Mark.Tests/​Linting/​MarkdownProseExtractorTests.cs Tests front matter extraction and edge cases.
test/​DemaConsulting.Ste100Mark.Tests/​Linting/​LinterTests.cs Verifies metadata is excluded from lint findings.
src/​DemaConsulting.Ste100Mark/​Linting/​MarkdownProseExtractor.cs Implements front matter detection and skipping.
docs/​verification/​ste100-mark/​linting.md Documents verification coverage.
docs/​reqstream/​ste100-mark/​linting.yaml Adds front matter requirement traceability.
docs/​reqstream/​ste100-mark.yaml Links the requirement to system linting.
docs/​design/​ste100-mark/​linting/​markdown-prose-extractor.md Documents extractor behavior and design.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Malcolmnixon
Malcolmnixon merged commit ac0a209 into main Sep 29, 2026
20 of 21 checks passed
@Malcolmnixon
Malcolmnixon deleted the feat/frontmatter-recognition branch September 29, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants