markup icon indicating copy to clipboard operation
markup copied to clipboard

Code Blocks badly broken

Open NetScr1be opened this issue 1 year ago • 1 comments

I get we need to be careful about how we write Github markdown and respect the standard.

We can't expect to dump a bunch of crufty crap in a file and expect it to render properly but this is a bit much.

Code blocks don't work (especially when combined with bullets and/or tasks) unless everything is perfectly vertically aligned AND there are no trailing spaces.

I've read the other issues on this topic which is how I know about the alignment peculiarity but I found the trailing spaces thing on my own.

This is beyond finicky. The [*Writing Code Blocks* reference](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) makes no mention of either alignment or trailing spaces.

I've been over this text ten times at least (see image below) re-aligning this and remove all the stray space characters and have been able to make some progress but the rendering engine loses its way towards bottom of the file and kind of gives up.

URL: NetScr1be/XRPLLabs.Bluesky#1

I'd be happy to attach a copy of the file for review if the [documentation on attachments[(https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files) agreed with what we are seeing here.

I too work for a software company and have written ~150 help articles and am the editor for what others write (in Gitbook BTW). I'm not some lost lost markdown newbie.

Can we please get some attention on what (according to the issues in this repo) is a long-standing issue?

Just really looking for some consistency so we can at least find our own way through it.

NetScr1be avatar Feb 23 '24 17:02 NetScr1be

BTW, I was ***finally*** able to get the text to render properly after I found the blank line with four spaces in it in the middle of the code block.

Back in the day, (been in computers for 40 years now) four spaces was a tab.

The original markdown syntax hijacked the four-space tab for code blocks  and subsequently included fenced code blocks in the [*Extended Syntax*](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks).

The [*Basic Syntax* for Markdown code blocks](https://www.markdownguide.org/basic-syntax/#code) specifies;

> indent ***every line*** of the block by at least four spaces or one tab.

There is also a note that indents can be avoided by using fenced code blocks

Re-reviewing the docs on Github Markdown Code Blocks finds the only mention of spaces to be;

> Tip: To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces.

This is weird because this is the only mention of ***non-fenced*** code blocks.

The rendering engine seems to be indent and/or fencing promiscuous in that it accepts any combination of indents, fencing and who knows what else.

Please pick a lane.

If there are fences then indents are for formating only - i.e. they ***DO NOT*** denote the beginning/end of a code block.

There is no reason to assign any kind of meaning to a few spaces on an otherwise blank line in a fenced-in area.

NetScr1be avatar Feb 23 '24 18:02 NetScr1be