Skip to content

Instantly share code, notes, and snippets.

@chase-moskal
Last active July 30, 2025 01:37
Show Gist options
  • Save chase-moskal/0714c9b5e974f99162774d24524a099a to your computer and use it in GitHub Desktop.
Save chase-moskal/0714c9b5e974f99162774d24524a099a to your computer and use it in GitHub Desktop.
demo of a github markdown rendering bug

this is a demonstration of a bug in github's markdown rendering with tabs.. in code blocks nested under bullets, lines are rendered with an extra leading space character..

bullet list

  • ❌ yukon
     alpha
     	alpha
     		alpha
     	alpha
     alpha
    
    • ❌ british columbia
       bravo
       	bravo
       		bravo
       	bravo
       bravo
      

number list

  1. ✅ washington
    charlie
    	charlie
    		charlie
    	charlie
    charlie
    
    1. ✅ oregon
      delta
      	delta
      		delta
      	delta
      delta
      

hybrid number/bullet

  1. ✅ baja california
    echo
    	echo
    		echo
    	echo
    echo
    
    • ❌ sonora
       foxtrot
       	foxtrot
       		foxtrot
       	foxtrot
       foxtrot
      
@chase-moskal
Copy link
Author

see this image of how my browser (firefox) is rendering this markdown:

image

i've highlighted (1) the good rendering of the numbered code block, vs (2) the bad rendering of the bulleted code block with the unwanted leading space

@chase-moskal
Copy link
Author

observe that this problem does not occur with the same raw text input at https://markdownlivepreview.com/

@chase-moskal
Copy link
Author

⚠️ important — this is not just merely an aesthetic problem — when you copy-paste the code, the leading spaces are actually injected into the resulting payload.

said differently, github is actually mangling the code, which will cause syntax errors in some languages.

the code blocks aren't just aesthetically wrong — they are functionally broken.

@ioquatix
Copy link

Great visual.

@iwoodroroo
Copy link

I don't get it

@chase-moskal
Copy link
Author

@iwoodroroo

i'll try to explain this more clearly:

if you are using tabs for indentation in a markdown github readme (which is nice because, with tabs, the indents are now displayed in accordance with the user's own preferences) — the problem is that there is a bug on github, where the text in some codeblocks is actually mangled — unwanted spacebar characters are inserted into the codeblock where none exist in the markdown source — this will cause confusing failures when somebody copy-and-pastes code snippets, because some programming languages require strictly correct indentation.

for more context, see this community discussion, and this one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment