Closed LitoMore closed 2 weeks ago
An easier example test-case:
[Example Link](https://example.com/page\_with\_underscores)
Fixing it might be as simple as
Event::Start(Tag::Link { link_type, dest_url, .. }) => {
match link_type {
LinkType::Inline => {
Some(vec![RawUri {
text: unescape_url(&dest_url),
element: Some("a".to_string()),
attribute: Some("href".to_string()),
}])
}
// ... handle other link types similarly
}
}
// Helper function which removes escape characters from Markdown links
fn unescape_url(url: &str) -> String {
url.replace("\\_", "_")
}
in the code here and in the other place where we call text: dest_url.to_string()
.
If anyone likes to create a pull request, I'd be thankful. Bonus points for adding the example above as a test-case.
Note there are two errors, this means the first line also errored.
- <img height="14" src="https://cdn.simpleicons.org/simpleicons/_/eee"/> - https://cdn.simpleicons.org/simpleicons/_/eee
Turns out it was an issue with the Markdown parser. More details in #1555.
How to reproduce
Use this markdown below:
It returns: