-
Notifications
You must be signed in to change notification settings - Fork 286
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
Improvements to standalone header #1903
Conversation
krlmlr
commented
Oct 22, 2023
- Use correct host and ref in URL
- Add "generated by" code
ref_string <- ref %||% "HEAD" | ||
host_string <- host %||% "https://github.com" | ||
source_comment <- | ||
glue("# Source: {host_string}/{repo_spec}/blob/{ref_string}/{path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works better in Positron to not surround this with <>
, i.e. the automatic hyperlink detection copes better with this form.
|
||
path_string <- path_ext_remove(sub("^standalone-", "", basename(path))) | ||
ref_string <- if (is.null(ref)) "" else glue(', ref = "{ref}"') | ||
host_string <- if (is.null(host) || host == "https://github.com") "" else glue(', host = "{host}"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only include host
if it's something other than github.com. Only include ref
if the user explicitly did so.
Thanks! |