Kryptos-FR / markdig.wpf

A WPF library for xoofx/markdig https://github.com/xoofx/markdig
MIT License
159 stars 50 forks source link

Incorrect space between EmphasisInlineElements #12

Closed lellid closed 6 years ago

lellid commented 6 years ago

In markdown like a**b**c or H~2~O, there is a space inserted between the emphasized element and the next element. This is caused by the function WpfRenderer.EndsWithSpace, which returns (IMHO correctly) that there is no space at the end of the emphasized element, and then the function AddInline inserts a space.

What is the best way to avoid the incorrect insertion of the space?

Kryptos-FR commented 6 years ago

@grokys Do you remember what was the purpose of adding this space? I haven't touched the code for a while so I'm having trouble to see which cases that handles.

grokys commented 6 years ago

Hmm I can't quite remember tbh. I do seem to remember that some formatting was broken if there was no space inserted. Could be that the heuristic just needs to be changed? I will try to remember the exact case...

lellid commented 6 years ago

I experimented with commenting out the insertion of the space. The only negative effect I found so far is the following markdown:

This
is
normally
text
with
spaces.

with is rendered without spaces between the words when I commented out the insertion of the spaces.

Kryptos-FR commented 6 years ago

Fixed by #13.