GitHub profile link in `NEWS` not generated if it's the first word in the list item
For minimal reprex, see: https://github.com/IndrajeetPatil/minimalReprex/
The following, when rendered on the website,
# 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.
looks like this:

What a great username example :wink: Thanks for the reprex.
Regex https://github.com/r-lib/pkgdown/blob/25a1ab2d04c2b8251214b5189fa6735896468cd7/R/repo.R#L41 Tests https://github.com/r-lib/pkgdown/blob/25a1ab2d04c2b8251214b5189fa6735896468cd7/tests/testthat/test-repo.R?q=repo_auto_link#L12
Maybe the regex should be tweaked, or maybe this behavior is intended, I am afraid I do not know which. :sweat_smile:
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.