Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support underscores in Markdown URLs #1555

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Support underscores in Markdown URLs #1555

merged 1 commit into from
Nov 7, 2024

Conversation

mre
Copy link
Member

@mre mre commented Nov 7, 2024

By default, pulldown_cmark produces multiple text events if it detects an _. That is for performance reasons. More information [here](See pulldown-cmark/pulldown-cmark#146).

The correct way to handle this is by using the TextMergeStream helper-struct, which provides an iterator that merges consecutive Event::Text events into one.

With this, we can correctly parse links like http://example.com/_/foo.

Fixes #1529

By default, `pulldown_cmark` produces multiple text events if it detects an `_`. That is for performance reasons. More information [here](See pulldown-cmark/pulldown-cmark#146).

The correct way to handle this is by using the [`TextMergeStream`](https://docs.rs/pulldown-cmark/latest/pulldown_cmark/utils/struct.TextMergeStream.html) helper-struct, which provides an iterator that merges consecutive `Event::Text` events into one.

With this, we can correctly parse links like `http://example.com/_/foo`.

Fixes #1529
@mre mre force-pushed the fix/markdown-escape branch from 8dbaf45 to cab3d3e Compare November 7, 2024 13:50
@mre mre merged commit 6b53695 into master Nov 7, 2024
7 checks passed
@mre mre deleted the fix/markdown-escape branch November 7, 2024 13:54
@mre mre mentioned this pull request Nov 7, 2024
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.

Fails on escape characters in markdown link
1 participant