Skip to content

feat: parse header id #65#66

Merged
AndrewSouthpaw merged 7 commits intothlorenz:masterfrom
thompson-tomo:feat/#65_headerID
Apr 19, 2026
Merged

feat: parse header id #65#66
AndrewSouthpaw merged 7 commits intothlorenz:masterfrom
thompson-tomo:feat/#65_headerID

Conversation

@thompson-tomo
Copy link
Copy Markdown
Contributor

Closes: #65

This pulls out the header id from the text.

@thompson-tomo
Copy link
Copy Markdown
Contributor Author

@AndrewSouthpaw can you take a look and once merged release as 0.9.

Copy link
Copy Markdown
Collaborator

@AndrewSouthpaw AndrewSouthpaw left a comment

Choose a reason for hiding this comment

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

There's a bunch of cases missed by this implementation:

Test Expected Actual
Standard {#head} [Heading Text](#head) [Heading Text](#hea)
Unclosed {#foo [Heading {#foo](#heading-foo) [Heading](#f)
Trailing text [Heading {#foo} trailing](#heading-foo-trailing) [Heading](#foo%7D%20traili)
Mid-text {#hashes} [Set of {#hashes} in prose](#set-of-hashes-in-prose) [Set of](#hashes%7D%20in%20pro)

I'm going to add a set of tests and a proposed fix...

Covers: standard single-brace {#id}, unclosed {#, trailing text after
{#id}, and literal {# mid-text. All four fail against the current
split/slice implementation.
Replaces split/slice with a single end-of-line anchored regex that
requires a balanced {#id}. Unclosed braces, trailing text, and mid-text
{# are now left as literal header text.

Drops the non-standard {:id:} syntax — kramdown's actual IAL syntax is
{: #id}, not {:id:}, so the PR as written didn't match any real flavor.
@AndrewSouthpaw
Copy link
Copy Markdown
Collaborator

Opened a fix here: thompson-tomo#8

@thompson-tomo
Copy link
Copy Markdown
Contributor Author

Thanks for your assistance/input with this @AndrewSouthpaw

@AndrewSouthpaw AndrewSouthpaw merged commit 959709a into thlorenz:master Apr 19, 2026
4 checks passed
@thompson-tomo thompson-tomo deleted the feat/#65_headerID branch April 19, 2026 15:43
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.

Parse header id

2 participants