How do I view the source of Markdown files on Gith

2019-01-25 04:14发布

问题:

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.

回答1:

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.



回答2:

Using the "Blame" button, you are able to see the source of the Markdown (for example, like this).

Unfortunately, "Blame" comes with extra UI elements which make the source more cluttered.