showdown icon indicating copy to clipboard operation
showdown copied to clipboard

Characters " " inside Code Block instead of space

Open yoric-m opened this issue 5 years ago • 6 comments

I'm a new Showdown user, experimenting the CLI tool to convert my markdown pages into static html files for my blog. I'm very happy with it so far. However, I just stumbled upon a Gotcha while copy/pasting my directory structure inside a block of code (using the triple backticks).

Does someone knows why the rendering with Showdown is like this:

tree
├── folder1
│   └── a.txt
└── folder2
    └── b.txt

While it is like this in other markdown to html converter (and also here on Github):

tree
├── folder1
│   └── a.txt
└── folder2
    └── b.txt

It looks like Showdown is putting &amp;nbsp; inside the <pre><code> tag instead of &nbsp; to render the space character.

I'm really not sure if I'm misusing it or if it's a bug. Does anyone one has an idea about it?

yoric-m avatar Mar 06 '19 04:03 yoric-m

Bug confirmed.

The input text has non-breaking spaces inside the code block which get converted to the correspondent html entity &nbsp;. However, then the code block is encoded again, changing & to &amp; resulting in that weird behavior.

tivie avatar Mar 16 '19 12:03 tivie

i met the same problem

djlxiaoshi avatar Nov 06 '20 15:11 djlxiaoshi

Same here, I got this: ¨NBSP;

gengue avatar Sep 03 '21 22:09 gengue

Same here, => { becomes =&gt; { in <pre><code> and <code> blocks. Inspecting reveals =&amp;gt {.

Stonks3141 avatar Apr 27 '22 19:04 Stonks3141

we are working on a fix for this (and other related issues).

tivie avatar Apr 28 '22 06:04 tivie

should be fixed. Will be merged in develop soon.

tivie avatar May 09 '22 03:05 tivie