Skip to content

Conversation

krlmlr
Copy link
Member

@krlmlr 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}")
Copy link
Member

@jennybc jennybc Jul 24, 2024

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}"')
Copy link
Member

@jennybc jennybc Jul 24, 2024

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.

@jennybc
Copy link
Member

jennybc commented Jul 24, 2024

Thanks!

@jennybc jennybc merged commit acac3f9 into main Jul 24, 2024
@jennybc jennybc deleted the f-standalone-code branch July 24, 2024 18:10
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 this pull request may close these issues.

2 participants