-
Notifications
You must be signed in to change notification settings - Fork 334
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
GitHub profile link in NEWS
not generated if it's the first word in the list item
#2030
Comments
What a great username example 😉 Thanks for the reprex. Regex Line 41 in 25a1ab2
Tests pkgdown/tests/testthat/test-repo.R Line 12 in 25a1ab2
Maybe the regex should be tweaked, or maybe this behavior is intended, I am afraid I do not know which. 😅 |
I can't reproduce: text <- "# minimalReprex 0.0.0.9000
* @maelle fixed this bug in PR XYZ.
* Thanks, @maelle, for discovering this bug.
* Added a `NEWS.md` file to track changes to the package."
pkg <- list(
repo = list(
url = list(
user = "http://example.com/users/"
)
)
)
cat(pkgdown:::repo_auto_link(pkg, text))
#> # minimalReprex 0.0.0.9000
#>
#> * <a href='http://example.com/users/maelle'>@maelle</a> fixed this bug in PR XYZ.
#>
#> * Thanks, <a href='http://example.com/users/maelle'>@maelle</a>, for discovering this bug.
#>
#> * Added a `NEWS.md` file to track changes to the package. Created on 2022-06-01 by the reprex package (v2.0.1) |
But I do see it with a fuller reprex: pkg <- local_pkgdown_site(meta = "
repo:
url:
user: https://example.com
")
write_lines(path = file.path(pkg$src_path, "NEWS.md"),
"# testpackage 0.0.0.9000
* @maelle fixed this bug in PR XYZ.
* Thanks, @maelle, for discovering this bug.
* Added a `NEWS.md` file to track changes to the package."
)
cat(build_news(pkg)$html) |
Oh, because the text being processed is HTML: <div id="testpackage-0009000" class="section level2">
<h2 class="page-header" data-toc-text="0.0.0.9000">testpackage 0.0.0.9000</h2>
<ul><li><p>@maelle fixed this bug in PR XYZ.</p></li>
<li><p>Thanks, @maelle, for discovering this bug.</p></li>
<li><p>Added a <code>NEWS.md</code> file to track changes to the package.</p></li>
</ul></div> |
Minimal reprex: pkg <- list(
repo = list(
url = list(
user = "http://example.com/users/"
)
)
)
cat(pkgdown:::repo_auto_link(pkg, "<p>@maelle</p>"))
#> <p>@maelle</p> Created on 2022-06-01 by the reprex package (v2.0.1) |
Reopening since my fix didn't handle the case of pre-existing links (#2122) and I had to revert it. |
Fixes r-lib#2030 (not creating links at line starts) while not breaking r-lib#2122, for most common use case.
For minimal reprex, see: https://github.com/IndrajeetPatil/minimalReprex/
The following, when rendered on the website,
looks like this:
The text was updated successfully, but these errors were encountered: