Skip to content

make convert_hn() public instead of internal - #213

Merged
chrispy-snps merged 1 commit into
matthewwithanm:developfrom
chrispy-snps:chrispy/make-convert_hn-public
Apr 20, 2025
Merged

chrispy-snps merged 1 commit into
matthewwithanm:developfrom
chrispy-snps:chrispy/make-convert_hn-public

Conversation

@chrispy-snps

Copy link
Copy Markdown
Collaborator

Make convert_hn() public instead of internal, to allow for custom heading conversion functions.

@chrispy-snps
chrispy-snps requested a review from AlexVonB April 12, 2025 23:18
@AlexVonB

Copy link
Copy Markdown
Collaborator

This reverts 3466061 which fixed the bug that converting <hn>foo</hn> crashed the converter. Do you see a way to fix both?

@chrispy-snps

Copy link
Copy Markdown
Collaborator Author

@AlexVonB - there is no <hn> tag in HTML so that was probably just an unfortunate coincidence with the typo.

We could rename convert_hn() to convert_hn_all() (which could still collide with <hn_all>). Or we could use a naming convention other than convert_<name>(), but I'm not sure I like that.

What are your thoughts?

@chrispy-snps
chrispy-snps force-pushed the chrispy/make-convert_hn-public branch from 8cda560 to ee8c98f Compare April 19, 2025 17:44
@chrispy-snps

Copy link
Copy Markdown
Collaborator Author

@AlexVonB - I updated the pull request to use convert_hN() for heading tags, which will not collide because conversion functions specific to tag names are all-lowercase.

@chrispy-snps
chrispy-snps force-pushed the chrispy/make-convert_hn-public branch from ee8c98f to fb34e5b Compare April 19, 2025 22:03
@chrispy-snps
chrispy-snps force-pushed the chrispy/make-convert_hn-public branch from fb34e5b to 960e2cd Compare April 19, 2025 23:19
@AlexVonB

Copy link
Copy Markdown
Collaborator

Perfect solution! I pondered a bit on the initial problem but this is the best solution

@chrispy-snps
chrispy-snps merged commit e29de4e into matthewwithanm:develop Apr 20, 2025
Wuhall pushed a commit to Wuhall/python-markdownify that referenced this pull request May 21, 2025
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