DavidT
DavidT

Reputation: 2481

Unstyled list of links inconsistent across github markdown

I would like an unstyled list of links on github wiki/documentation. My assumption given adam-p's markdown cheatsheet was that a single press of the <enter> key should break the line.

However this:

[link1](#link1)
[link2](#link2)
[link3](#link3)

Renders as the below on the Github wiki pages:

enter image description here enter image description here However on the Issues pages it renders differently:

enter image description here enter image description here

I need an unstyled list of links displayed in a block. Why is it not consistent across the Github website? Is this a bug or do i legitimately need to use something like a <br> tag?

Update

Adding 2 spaces to the end of each line works for breaking the line however it also seems to break the links.

enter image description here

enter image description here

Update 2

Through chat with @Chris and further investigating it turns out the broken links issue only appears when editing a page rather than creating one. Exactly the same md renders fine. Therefore we are putting it down to a special case.

Upvotes: 0

Views: 404

Answers (1)

Chris
Chris

Reputation: 136948

The reason this is happening might be what is shown on the API documentation for the Markdown rendering service. I've bolded the most important bits:

The rendering mode. Can be either:

  • markdown to render a document as plain Markdown, just like README files are rendered.

  • gfm to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.

So, for some reason, GitHub has elected to support two slightly different models depending on where the Markdown code exists.

I need an unstyled list of links displayed in a block.

Assuming this means you want the behaviour you see in issues, where each link appears on a new line, you can achieve it by following each item with two trailing spaces. This is how <br> tags are represented in the original Markdown implementation:

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

This should work anywhere on GitHub where Markdown is rendered.

Upvotes: 1

Related Questions