Kosmo.Markdown
0.1.2
dotnet add package Kosmo.Markdown --version 0.1.2
NuGet\Install-Package Kosmo.Markdown -Version 0.1.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kosmo.Markdown" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kosmo.Markdown" Version="0.1.2" />
<PackageReference Include="Kosmo.Markdown" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kosmo.Markdown --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Kosmo.Markdown, 0.1.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kosmo.Markdown@0.1.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kosmo.Markdown&version=0.1.2
#tool nuget:?package=Kosmo.Markdown&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Kosmo.Markdown
A Markdown render component for Blazor, built on Markdig. Written for the KOSMO assistant, usable in any Blazor app (Server or WebAssembly).
Features
- Streaming rendering: designed for LLM token streams. New text fades in smoothly while the document keeps updating, throttled to avoid re-rendering on every token.
- Mermaid diagrams: fenced ```mermaid blocks render as diagrams, with expand and SVG download actions.
- Code blocks with copy button and a code/preview toggle.
- Reference chips: inline source annotations that raise a click event, for RAG-style per-passage citations.
- Document cards: inline
<document id="..." title="..."/>tags render as clickable cards with a built-in loading animation, for assistant-generated documents. - URL sanitization: links and images are sanitized before rendering.
- Localizable labels: every UI string (Copy, Preview, Expand, ...) is a component parameter.
Install
dotnet add package Kosmo.Markdown
Usage
@using Kosmo.Markdown
<KosmoMarkdown Value="@markdownText"
IsStreaming="@isStreaming"
References="@references"
OnReferenceClicked="@HandleReferenceClick" />
| Parameter | Type | Description |
|---|---|---|
Value |
string? |
The Markdown source to render. |
IsStreaming |
bool |
Set true while tokens are still arriving to enable throttled rebuilds and fade-in. |
References |
IReadOnlyList<MarkdownReference>? |
Optional source references rendered as chips. |
OnReferenceClicked |
EventCallback<int> |
Raised with the reference index when a chip is clicked. |
OnDocumentClicked |
EventCallback<string> |
Raised with the document id when a document card is clicked. The card shows a loading animation until the callback completes. |
CopyLabel, PreviewLabel, CodeLabel, DiagramErrorLabel, DownloadSvgLabel, ExpandLabel, CloseLabel, DocumentHintLabel |
string |
UI label overrides for localization. |
Development
dotnet build Kosmo.Markdown.sln
dotnet test Kosmo.Markdown.Tests
License
Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Markdig (>= 1.3.2)
- Microsoft.AspNetCore.Components.Web (>= 10.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.