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

Link to external issue overwritten with link to nonexistent internal issue #2122

Closed
jabenninghoff opened this issue Jun 12, 2022 · 3 comments · Fixed by #2142
Closed

Link to external issue overwritten with link to nonexistent internal issue #2122

jabenninghoff opened this issue Jun 12, 2022 · 3 comments · Fixed by #2142

Comments

@jabenninghoff
Copy link

jabenninghoff commented Jun 12, 2022

In pkgdown 2.0.3, the following markdown links to #2092 in NEWS.md.

[#2092](https://github.com/r-lib/pkgdown/issues/2092)

In pkgdown 2.0.4, the same code links to the issue for the repository that generated the pkgdown, which seems to be caused by #2104, as a link is added within the link:

From https://github.com/jabenninghoff/testpkg/blob/9510b647385299efdd99d85125a32f6e11fb784c/docs/news/index.html#L54:

<li><p>See issue <a href="https://github.com/r-lib/pkgdown/issues/2092" class="external-link"></a><a href="https://github.com/jabenninghoff/testpkg/issues/2092" class="external-link">#2092</a></p></li>

Full reprex at: https://github.com/jabenninghoff/testpkg, see: NEWS.md, DESCRIPTION (URL, BugReports).

@hadley
Copy link
Member

hadley commented Jun 17, 2022

Hmmmm, this is going to be tricky to fix with our current regular expression based approach. Maybe we need to switch to something that uses more xpath.

@jabenninghoff
Copy link
Author

One thought I had was, it should be possible to create a regex that matches most tags but not <a>, but XPath seems like a better approach.

@hadley
Copy link
Member

hadley commented Jun 22, 2022

Test for the problem:

  # or existing links
  expect_equal(repo_auto_link(pkg, "<a href=''>#123</a>"), "<a href=''>#123</a>")

hadley added a commit that referenced this issue Jun 22, 2022
Because it causes spurious matches when if links are already present. Fixes #2122.
@hadley hadley mentioned this issue Jun 22, 2022
hadley added a commit that referenced this issue Jun 22, 2022
Because it causes spurious matches when if links are already present. Fixes #2122.
hadley pushed a commit that referenced this issue Mar 11, 2024
Fixes #2030 (not creating links at line starts) while not breaking #2122, for most common use case.
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this issue Jun 1, 2024
Fixes r-lib#2030 (not creating links at line starts) while not breaking r-lib#2122, for most common use case.
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 a pull request may close this issue.

2 participants