link creates a permalink to the remote file and copies it to your
clipboard for easy sharing. This permalink is based on the HEAD commit
of the local git repo.
browse does the same thing, but also opens the website in your default
Works with Github, Gitlab, and Bitbucket repos.
1 2 3
path to the file. The path may be relative to the current
working directory, or an absolute path.
Name of the remote to link to.
Optionally, you can change by setting
path argument, you can optionally include line numbers after
the path to the file. See the examples section below. Formatting varies
between Github, Gitlab, and Bitbucket.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## Not run: # works on an RStudio selection in the editor browse() link() # working directory is the top level of repo browse("R/browse.R") link("R/browse.R#L6-L9") # working directory is the R/ folder of repo link("../README.md") # relative or absolute paths to other repos browse("~/rpackages/dplyr/DESCRIPTION") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.