Skip to content

Escape configured requirement prefixes in regular expressions #13

Description

@tylerwillis

Context: #10 exposed that configured prefix values are interpolated directly into several regular expressions in src/spec.ts and src/annotations.ts. Prefixes containing regex metacharacters can be misinterpreted or cause regex construction failures.

Source: deferred item in the final dual-review triage: #10 (comment)

Why deferred: The behavior predates PR #10 on origin/main and is separate from the file-scoped-ID feature's approved scope.

Implementation outline:

  • Introduce a shared regex-escaping helper for literal configured prefixes.
  • Apply it consistently to spec classification, legacy heading parsing, annotation scanning, and hash classification.
  • Add tests using metacharacter-bearing prefixes, including one that would otherwise throw.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions