Github helpfully renders Markdown (.md
) files to HTML when viewing on github.com (for example, this README.md
).
When viewing any other source file, it is shown as unrendered source code (for example, this .gitignore
). A handy feature this gives is linking directly to a line in the source by clicking the line number (for example, like this).
How can I view the unrendered source of Markdown files on Github (so I can link to a particular line in the source)?
note: I know of the "Raw" button, however it does not provide any of the nice UI Github has.
Viewing or copying the raw file contentOn GitHub.com, navigate to the main page of the repository. Click the file that you want to view. In the upper-right corner of the file view, click Raw.
Just alt-tab between your editor and browser, and it will automatically re-render the markdown, and it looks exactly like it does on GitHub.
To do that, right-click the extension icon in the in the toolbar and then select Manage Extensions. Scroll down until you see Allow Access to File URLs and toggle the switch to the On position. Now that Markdown Preview Plus is fully set up, you can drag any Markdown-formatted file into the browser to preview it.
If you don't want to use the "raw" button, you can (since June 2021) add ?plain=1
to your GitHub markdown file URL:
Appending
?plain=1
to the url for any Markdown file will now display the file without rendering.As with other code files, it will also show line numbers, and can be used to link other users to a specific line or lines.
For example, appending?plain=1#L52
will highlight line 52 of a plain text Markdown file.
Example:
https://github.com/git/git/blob/master/README.md?plain=1#L49-L51
Since Sept. 2021, there is a button which adds the ?plain=1
for you:
Use the "Raw" button. For instance, if you were looking at README.md there is a Raw button in the Navigation. This can be simple URL change (from blob to raw), but in this case becomes a separate link.
Edit: There is no "pretty" view for the Markdown source. There's the converted HTML view, the Raw view without the UI, and the Blame view. Only the Blame view provides you with the ability to link to a specific line within the source.
Edit 2: The other option is to use Anchors within the README.md. If you take the Installation title for example, you can directly link within the content of the Markdown file. Assuming you don't have anything hidden within the Markdown itself, this is closer still to solving your original question.
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