neolithos / NeoMarkdigXaml

Markdig Xaml/Wpf Renderer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong rendering of emphasis and strong emphasis inlines

exactamente opened this issue · comments

According to the CommonMark specification (e.g. the latest one v0.28) "6.4 Emphasis and strong emphasis" the difference between emphasis (rendered in italics) and strong emphasis (rendered in bold) is not only a character but is it single or doubled.

So the single asterisk or the single underscore is emphasis, and doubled asterisk or doubled underscore is strong emphasis.

But EmphasisInlineRenderer in method WriteSpan cares only about delimiter character:

public class EmphasisInlineRenderer : XamlObjectRenderer<EmphasisInline>
{
	private static bool WriteSpan(XamlMarkdownWriter renderer, EmphasisInline span)
	{
		switch (span.DelimiterChar)
		{
			case '*': // bold
				renderer.WriteStartObject(typeof(Bold));
				return true;
			case '_': // italic
				renderer.WriteStartObject(typeof(Italic));
				return true;
			...
		}
	} // proc WriteSpan
...
}

Thx. Do you need an update of the nuget packages?

Yes, please.

Done.