using Microsoft.AspNetCore.Components; namespace AIStudio.Chat; /// /// A formula of its own in the chat, which MathJax typesets, with a button to copy it and the actions /// of its file, such as a button to save it. /// /// /// The buttons stand next to the element MathJax typesets, not inside it: MathJax replaces the content /// of that element, see chat-math.js. /// public partial class MathJaxBlock { /// /// The formula, without the markers around it. The copy button copies it like this. /// [Parameter] public string Value { get; init; } = string.Empty; [Parameter] public string Class { get; init; } = string.Empty; /// /// The file of the formula, as PlainFileExport.ExtractFiles read it, or null when the formula /// cannot be saved, for example in a message whose code blocks cannot be saved either. /// [Parameter] public MessageFile? File { get; init; } /// /// What to show next to the copy button for the file, for example a button to save it. /// [Parameter] public RenderFragment? Actions { get; init; } private string RootClass => string.IsNullOrWhiteSpace(this.Class) ? "formula-block" : $"formula-block {this.Class}"; private string MathText => $"$${Environment.NewLine}{this.Value}{Environment.NewLine}$$"; }