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

Fail to parse html a link with preceding content #126

Closed
leandrocp opened this issue Mar 17, 2023 · 4 comments
Closed

Fail to parse html a link with preceding content #126

leandrocp opened this issue Mar 17, 2023 · 4 comments

Comments

@leandrocp
Copy link

Tested on 1.4, 1.5, and master branches for both earmark and earmark_parser getting the same result:

iex> Earmark.as_html!("reading <a href=\"http://amzn.com/1592535879\">The Universal Principles of Design</a>")
"<p>\nreading &lt;a href=”<a href=\"http://amzn.com/1592535879%22\">http://amzn.com/1592535879”</a>&gt;The Universal Principles of Design&lt;/a&gt;</p>\n"

Is that format expected? If so, how can I help fixing it?

@RobertDober
Copy link
Owner

HTML tags are only supported when starting a line and behavior for the rest of the line is undefined.

Maybe the docs could be clearer on that.

@leandrocp
Copy link
Author

Hi @RobertDober thanks for feedback

@flys1ck
Copy link

flys1ck commented Mar 21, 2023

HTML tags are only supported when starting a line and behavior for the rest of the line is undefined.

Maybe the docs could be clearer on that.

@RobertDober Ran into the same problem and did not understand why this issue was closed. Does it mean, that links with preceding content are not supported by EarmarkParser? If so, are there plans to support it in the future?

Example string

Hello <a target="_blank" href="https://example.com">Example</a>

Expected Result

https://babelmark.github.io/?text=Hello+%3Ca+target%3D%22_blank%22+href%3D%22https%3A%2F%2Fexample.com%22%3EExample%3C%2Fa%3E

Actual Result (notice that the link breaks)

CleanShot 2023-03-21 at 16 34 26

@RobertDober
Copy link
Owner

RobertDober commented Mar 21, 2023

This has been planned for EarmarkParser 1.5 for a long time, unfortunately I have barely time to maintain 1.4.x
:(
Should update the docs

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

No branches or pull requests

3 participants