mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-06 04:29:07 +00:00
Thorsten Sommer
c84184e5d1
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
30 lines
487 B
C#
30 lines
487 B
C#
using System.Text;
|
|
using Markdig.Syntax;
|
|
|
|
namespace MudBlazor;
|
|
|
|
internal static class FencedCodeBlockEx
|
|
{
|
|
public static string CreateCodeBlockText(this FencedCodeBlock @this)
|
|
{
|
|
if (@this.Lines.Count == 0)
|
|
return string.Empty;
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
foreach (var line in @this.Lines)
|
|
{
|
|
var str = line.ToString();
|
|
|
|
if (string.IsNullOrEmpty(str))
|
|
continue;
|
|
|
|
if (sb.Length != 0)
|
|
sb.AppendLine();
|
|
|
|
sb.Append(str);
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
} |