Skip to content

Formatting round 2: anchor tags visible, subsections not separated #31

@v1d0b0t

Description

@v1d0b0t

Problem 1: Section anchor IDs rendered as visible text

Section headings include {#section-8} which GitHub renders literally. GitHub markdown does not support {#id} syntax.

Fix: Use an HTML anchor tag above the heading: <a id="section-8"></a>

File: src/transforms/markdown.ts — section heading emitter

Problem 2: Subsections not separated by blank lines

Subsections (a), (b), (c) etc. are on separate lines in the raw markdown, but there's no blank line between them. In markdown, consecutive lines without a blank line are rendered as a single paragraph. GitHub renders them all running together.

Current raw markdown:

No disrespect should be shown to the flag...
**(a)** The flag should never be displayed...
**(b)** The flag should never touch...

Needed (blank lines between subsections):

No disrespect should be shown to the flag...

**(a)** The flag should never be displayed...

**(b)** The flag should never touch...

File: src/transforms/markdown.tsrenderSubsectionHeading() or the content node loop needs to prepend a blank line

Problem 3: All uscode.house.gov cross-reference links are broken

URLs are missing &num=0&edition=prelim query parameters. Without them, OLRC 302 redirects to docnotfound.xhtml.

File: buildCrossReference() in src/transforms/markdown.ts + source field in frontmatter

Problem 4: Note paragraphs concatenated into wall of text

Multiple <p> elements within a <note> (e.g., Executive Orders, Findings, Proclamations) are joined with spaces instead of paragraph breaks. The XML has proper <p> separation.

Example: Ex. Ord. No. 10834 has separate <p> elements for each WHEREAS clause, each Section, and each Part heading. Currently renders as one massive paragraph.

Fix: When rendering note content, join <p> elements with \n\n (double newline) instead of space.

File: likely in src/transforms/uslm-to-ir.ts (where note content is extracted) or src/transforms/markdown.ts (where notes are rendered)

Problem 5: Statutory notes from embedded Acts parsed as standalone sections

Text from embedded Acts (e.g., Pub. L. 109–243 'Freedom to Display the American Flag Act of 2005') is being parsed as top-level code sections (§ 1. SHORT TITLE., § 2. DEFINITIONS., etc.) and mixed in with the actual Title 4 sections. Same issue in Title 18 Chapter 44.

These are statutory notes that should remain within the note block, not promoted to section level.

File: src/transforms/uslm-to-ir.ts or src/transforms/parser.ts — section discovery logic

Problem 6: Historical and Revision Notes tables broken

Table data like RevisedSectionSource (U.S. Code)Source (Statutes at Large) is rendered as a single concatenated string with no formatting. The XML likely has table structure.

File: note rendering in src/transforms/markdown.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions