mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-06 09:29:05 +00:00
This is necessary due to issue https://github.com/MyNihongo/MudBlazor.Markdown/issues/247 I created a PR as well: https://github.com/MyNihongo/MudBlazor.Markdown/pull/246
25 lines
473 B
C#
25 lines
473 B
C#
using Markdig.Syntax.Inlines;
|
|
|
|
namespace MudBlazor;
|
|
|
|
internal static class EmphasisInlineEx
|
|
{
|
|
public static bool TryGetEmphasisElement(this EmphasisInline emphasis, out string value)
|
|
{
|
|
const string italics = "i", bold = "b";
|
|
|
|
value = emphasis.DelimiterChar switch
|
|
{
|
|
'*' => emphasis.DelimiterCount switch
|
|
{
|
|
1 => italics,
|
|
2 => bold,
|
|
_ => string.Empty
|
|
},
|
|
'_' => italics,
|
|
_ => string.Empty
|
|
};
|
|
|
|
return !string.IsNullOrEmpty(value);
|
|
}
|
|
} |