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

Handling of link title syntax gets confused #224

Closed
RichMorin opened this issue Mar 14, 2019 · 6 comments
Closed

Handling of link title syntax gets confused #224

RichMorin opened this issue Mar 14, 2019 · 6 comments
Assignees
Labels

Comments

@RichMorin
Copy link
Contributor

I have discovered a situation where Earmark's handling of link title syntax gets confused. I've boiled it down to two very similar input strings. One succeeds; the other fails:

iex(1)> s = "The [Foo](/dash 'foo') page in \"bar\"\n" 
"The [Foo](/dash 'foo') page in \"bar\"\n"
iex(2)> Earmark.as_html(s)                            
{:ok, "<p>The <a href=\"/dash\" title=\"foo\">Foo</a> page in “bar”</p>\n", []}

iex(3)> s = "The [Foo](/dash 'foo') page (in \"bar\")\n"
"The [Foo](/dash 'foo') page (in \"bar\")\n"
iex(4)> Earmark.as_html(s)                              
{:ok, "<p>The <a href=\"/dash\" title=\"bar\">Foo</a> page (in “bar”)</p>\n", []}

In boiling down the example, I ran across assorted peculiar behavior, so fixing the failing case above may or may not resolve all the problems. However, it seems like a good place to start.

@RobertDober
Copy link
Collaborator

Which case is failing? I feel the output is correct.

See also

https://babelmark.github.io/?text=The+%5BFoo%5D(%2Fdash+%27foo%27)+page+(in+%5C%22bar%5C%22)

@RichMorin
Copy link
Contributor Author

Sorry; I thought about pointing out the difference, but didn't get around to doing so. In the first case, the requested title (foo) is present in the HTML title attribute. In the second case, "bar" shows up as the title. The only difference in the input Markdown is the presence of parentheses around "<<in “bar”>>.

@RobertDober
Copy link
Collaborator

I apologize, as I am on leave I did not look at it as well as I should have.

I will take care of it as soon as I have time to do it correctly.

Thank you for your understanding.

@RobertDober RobertDober self-assigned this Mar 16, 2019
@RichMorin
Copy link
Contributor Author

RichMorin commented Mar 16, 2019 via email

RobertDober added a commit that referenced this issue Mar 16, 2019
@RobertDober RobertDober added this to the 1.3.2 milestone Mar 16, 2019
@RichMorin
Copy link
Contributor Author

I edited my mix.exs file as follows and the problem seems to have gone away:

  { :earmark, override: true,
      git: "https://github.com/pragdave/earmark.git" },

@RobertDober
Copy link
Collaborator

@RichMorin I just released https://hex.pm/packages/earmark/1.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants