Skip to content

[markdown] Omit the link and image title when the HTML has none - #8938

Merged
dlwh merged 1 commit into
marin-community:mainfrom
MaxFreedomPollard:fix-empty-markdown-link-title
Sep 11, 2026
Merged

dlwh merged 1 commit into
marin-community:mainfrom
MaxFreedomPollard:fix-empty-markdown-link-title

Conversation

@MaxFreedomPollard

Copy link
Copy Markdown
Contributor

Render an anchor or image with no title attribute as [text](href) and ![alt](src). convert_a and convert_img built the title suffix as ' "{title}"'.format(title=... if title else ""), so the conditional chose between the escaped title and an empty string inside the quotes instead of choosing between the suffix and no suffix. markdownify applies the conditional to the whole suffix, which is why its output carries no trailing "".

The default ResiliparseConfig keeps links and images, so this reached the web extraction path. Regenerating the fixtures with tests/snapshots/generate_expected.py removes 161 empty titles over 106 lines in 8 of the 11 tests/snapshots/web/expected/resiliparse files and changes nothing else. The wiki, ar5iv, stackexchange and dclm_hq fixtures are unchanged because those configs set include_links=False and include_images=False.

Render an anchor or image with no title attribute as [text](href) and
![alt](src). convert_a and convert_img built the title suffix as
' "{title}"'.format(title=... if title else ""), so the conditional chose
between the escaped title and an empty string inside the quotes instead of
choosing between the suffix and no suffix. markdownify applies the
conditional to the whole suffix, which is why its output carries no
trailing "".

The default ResiliparseConfig keeps links and images, so this reached the
web extraction path. Regenerating the fixtures with
tests/snapshots/generate_expected.py removes 161 empty titles over 106
lines in 8 of the 11 web/expected/resiliparse files and changes nothing
else. The wiki, ar5iv, stackexchange and dclm_hq fixtures are unchanged
because those configs set include_links=False and include_images=False.

@dlwh dlwh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@dlwh
dlwh merged commit b623b43 into marin-community:main Sep 11, 2026
34 of 35 checks passed
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