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

Links get incorrectly linkified twice #6557

Closed
frerich opened this issue Nov 29, 2019 · 1 comment · Fixed by #6568
Closed

Links get incorrectly linkified twice #6557

frerich opened this issue Nov 29, 2019 · 1 comment · Fixed by #6568
Labels
Milestone

Comments

@frerich
Copy link

@frerich frerich commented Nov 29, 2019

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.60.0-F2DEA9B0/extended darwin/amd64 BuildDate: 2019-11-27T10:16:12Z

Does this issue reproduce with the latest release?

Yes.

How to reproduce

  1. Create a new site

    $ ./hugo-0.60.0 new site mysite
    Congratulations! Your new Hugo site is created in /tmp/mysite.
    ...
    $ cd mysite
    
  2. Create a content file with two links; one in plain text and one using the []() markup:

    $ echo 'Go to [http://www.example.com](www.example.com) or http://www.example.com.' > content/_index.md
    
  3. Create a trivial layout for the home page:

    $ echo '{{ .Content }}' > layouts/index.html
    
  4. Build the web page

    $ hugo
    

Expected result

The same HTML code was was produced with Hugo v0.59.1 should be generated, i.e. I expect:

$  cat public/index.html
<p>Go to <a href="www.example.com">http://www.example.com</a> or <a href="http://www.example.com">http://www.example.com</a>.</p>

Note that both links yield the same HTML.

Observed result

With Hugo 0.60.0, the first link is marked up twice, i.e. I get an extra <a> element:

$ cat public/index.html
<p>Go to <a href="www.example.com"><a href="http://www.example.com">http://www.example.com</a></a> or <a href="http://www.example.com">http://www.example.com</a>.</p>

Additional notes

The issue can be mitigated somewhat by disabling the markup.goldmark.extensions.linkify option. However, this also disabled linkification of normal links, i..e you get

$ cat public/index.html
<p>Go to <a href="www.example.com">http://www.example.com</a> or http://www.example.com.</p>
@bep bep added Bug Upstream labels Nov 29, 2019
@bep bep added this to the v0.60.1 milestone Nov 29, 2019
@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Nov 29, 2019

@bep bep changed the title Regression in Hugo 0.60.0: Links get incorrectly linkified twice Links get incorrectly linkified twice Nov 29, 2019
@bep bep modified the milestones: v0.60.1, v0.60.2 Dec 1, 2019
bep added a commit to bep/hugo that referenced this issue Dec 1, 2019
@bep bep closed this in #6568 Dec 1, 2019
bep added a commit that referenced this issue Dec 1, 2019
Fixes #6557
@bep bep modified the milestones: v0.60.2, v0.61 Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.