mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-06 11:29:07 +00:00
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);
|
|||
|
}
|
|||
|
}
|