How can I create a permalink to specific lines in a .md or .Rmd file like README.md?
These files are rendered differently in github, so when I click on them I don't see the usual line-number editor where I can click on a line and ask it to give me the permalink to the selected lines, as described here.
To the left of the line or range of lines, click . In the drop-down menu, click Copy permalink . Navigate to the conversation where you want to link to the code snippet. Paste your permalink into a comment, and click Comment . You can link to specific lines in Markdown files by loading the Markdown file without Markdown rendering.
Just view the file in GitHub, select the lines you want to create a permalink to, and then click on "..."->"Copy permalink" as shown below: Use a named destination anchor. They can be used as link targets inside the same HTML document or in other documents. above the line that you want as a destination for your link.
Click "commit," add comment. Click the green arrow to push to GitHub. Go to GitHub, refresh the repository, and the markdown document with rendered code will be there When you knit, a new file will save to the Git window, called Title.docs
Changing output to github_document makes the original .rmd knit to .md so the code can be rendered when pushed to Git. In the Git window, check the box to stage Title.md [NOT .rmd] Click "commit," add comment. Click the green arrow to push to GitHub.
Yes you can, link to specific lines in a Markdown file, by going to the Blame view of the file.
Then, press y to get a permalink to the version of the file that you see now. This will ensure the link persists if the file changes, is moved, renamed or deleted.
At this point, you can click a link, or Shift+click a range of lines, and the URL will update automatically.
Here is an example link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With