Skip to content

feat(transformer): preserve sourceCredit and legislative history provenance - #282

Merged
williamzujkowski merged 1 commit into
mainfrom
feat/preserve-source-credit
Oct 6, 2026
Merged

williamzujkowski merged 1 commit into
mainfrom
feat/preserve-source-credit

Conversation

@williamzujkowski

Copy link
Copy Markdown
Collaborator

Description

This PR resolves issue #277 by extracting and preserving statutory enactment provenance and amendment history from OLRC USLM XML <sourceCredit> nodes into Markdown.

Changes

  1. USLM Elements:

    • Added sourceCredit: 'sourceCredit' to USLM_ELEMENTS in packages/transformer/src/constants.ts.
  2. Source Credit Formatting with External GovInfo Citations:

    • Implemented and exported formatSourceCredit in packages/transformer/src/markdown-generator.ts.
    • Automatically detects and resolves:
      • Statutes at Large references (/us/stat/{vol}/{page}) to authoritative GovInfo permalinks: https://www.govinfo.gov/link/statute/{vol}/{page}.
      • Modern Public Law citations (/us/pl/{congress}/{law}) to GovInfo permalinks: https://www.govinfo.gov/link/plaw/{congress}/public/{law}.
    • Cleans legal punctuation spacing (e.g. parenthesis and comma spacing) to conform with standard legal citation typography.
    • Wraps source credit in italic styling under a dedicated ## Source Credit heading immediately preceding statutory notes.
  3. Test Coverage:

    • Added unit tests in transformer.test.ts verifying link generation, empty handling, and integration with generateSectionBody.
    • Added integration assertions in uslm-v1-compat.test.ts verifying extraction and GovInfo link resolution on real OLRC XML (usc01-excerpt.xml).

Closes #277

…enance

- Add sourceCredit to USLM_ELEMENTS in packages/transformer/src/constants.ts
- Implement formatSourceCredit in markdown-generator.ts to parse enactment and amending citations
- Automatically generate authoritative GovInfo external links for Statutes at Large (/us/stat/) and Public Law (/us/pl/) references
- Cleanly render ## Source Credit in italic typography before Notes section
- Add unit and snapshot test coverage in transformer.test.ts and uslm-v1-compat.test.ts
- Resolves #277
@williamzujkowski
williamzujkowski requested a review from a team as a code owner October 6, 2026 14:18
@williamzujkowski
williamzujkowski merged commit ce8dcaf into main Oct 6, 2026
3 checks passed
@williamzujkowski
williamzujkowski deleted the feat/preserve-source-credit branch October 6, 2026 14:29
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.

feat(transformer): preserve <sourceCredit> and legislative history provenance in statute markdown

1 participant