Repository navigation
Escape GitHub @mentions in template update PR bodies - #491
Conversation
…tions Agent-Logs-Url: https://github.com/scverse/cookiecutter-scverse/sessions/e4339c85-f7eb-448e-a159-c267faf3583c Co-authored-by: grst <[email protected]>
There was a problem hiding this comment.
it’s probably fine, but if we wanted this to be robust, we’d need to
- parse markdown
- find the spans containing usernames
- if we parsed it as GFM with the username extension – just use that
- if we parsed as regular markdown – find the
@…pattern in regular text parts (but not code parts or so)
- replace (I guess just reversing the list of replacements before performing them would be fine)
|
I like the suggestion. Is there any library for GFM parsing that you would recommend? |
|
Hm, the established ones don’t have a real AST with source locations, but this one looks good: https://lbliii.github.io/patitas/ |
|
are you sure this supports parsing usernames? I couldn't find anything related to that in the docs... |
|
A PR has been generated to the instance repo: scverse/cookiecutter-scverse-instance#269 You can check out the PR to preview your changes in an instance of the cookiecutter template. |
I documented the limitations in the code and would leave it at that for now, WDYT? |
Release notes included in cruft update PRs contain raw
@usernamementions, causing all contributors to be subscribed to 150+ PRs on every release._escape_github_mentions()to wrap@username→`@username`using regex with negative lookbehind to skip already-escaped mentions and email addressesTemplateUpdatePR.bodyafter template formatting