Native Mermaid diagrams for Swift and C#.
NornaKit parses Mermaid text, measures it with the platform’s own text engine, lays it out and draws it with CoreGraphics or Win2D. No WebView, no JavaScript runtime, no network service.
Add the package in Package.swift or Xcode, then link the NornaKit product.
.package(url: "https://github.com/dufu1991/nornakit.git", from: "0.2.0")Reference the project directly until NuGet packages are published.
<ProjectReference Include="path/to/nornakit/Windows/src/NornaKit.Windows/NornaKit.Windows.csproj" />

Quick start
Three steps from Mermaid text to a diagram inside your app.
Add the library
Swift Package Manager on macOS. Project references to NornaKit.Core and NornaKit.Windows on Windows.
Render the source
The renderer parses Mermaid, measures text natively and lays the diagram out into an immutable scene.
Draw or export
Draw the scene in your own view, or export PNG, JPEG, TIFF, SVG and PDF from the same geometry.
import NornaKit
let diagram = try await NativeDiagramRenderer().render(
"flowchart LR\n A[Source] --> B[Native diagram]",
options: DiagramLayoutOptions(maxWidth: 640)
)
// Native geometry for CoreGraphicsDiagramPainter
let scene = diagram.scene
let svg = diagram.themedSVG(.appleLight)using NornaKit;
using NornaKit.Windows;
var renderer = WindowsDiagramRenderer.Create();
var diagram = await renderer.RenderAsync(
"flowchart LR\n A[Source] --> B[Native diagram]",
new DiagramLayoutOptions(MaxWidth: 640));
// Native geometry for Win2D or the DiagramPreview control
var svg = SvgExporter.Export(diagram.Scene, WindowsPalette.Resolve());Platforms
Two independent native implementations that share the same diagram families and layout model.
| macOS | Windows | |
|---|---|---|
| Language | Swift 6 | C# · .NET 10 |
| System | macOS 14+ | Windows 11 (build 22000+), x64 and ARM64 |
| Text | CoreText | DirectWrite |
| Drawing | CoreGraphics | Win2D |
| Export | PNG · JPEG · TIFF · SVG · PDF | PNG · JPEG · TIFF · SVG · PDF |
| Inline icons | :sf:name: SF Symbols | :win:name: Segoe Fluent Icons |
| Integration | Swift Package Manager | Project references (NuGet coming later) |
| Companion app | Norna Studio, Apple Silicon | WinUI 3 workbench, not yet released |
| Guide | macOS documentation → | Windows documentation → |
What’s included
Everything runs locally, inside your app’s process.
- Parsing with source locations
- Mermaid parsing for 33 diagram families, with error locations that point back to the source text.
- Native text measurement
- Labels are measured by CoreText or DirectWrite, so layout matches what the system actually draws.
- Adaptive layout
- Dedicated layouts per family that adapt to width limits and label length.
- One scene, every output
- On-screen drawing and every export format share the same immutable scene geometry.
- System appearances
- Light, dark and increased contrast, with configurable diagram colors.
- Inline icons and rich text
- SF Symbols or Segoe Fluent Icons inside labels, plus native rich text extensions.
Syntax support varies by diagram family. NornaKit does not claim complete Mermaid compatibility. See the support notes →
Examples
33 diagram families and 3 SF Symbols examples. Every image is real native output; select one to see its source.
Browse all 36 screenshots
Norna Studio
An optional Mac app for demos, rendering checks, debugging and occasional exports. You do not need it to use the library.
Norna Studio
macOS 14+ · Apple Silicon
brew install --cask dufu1991/tap/norna-studioBlocked when opening Norna Studio?
Norna Studio currently has no Developer ID signature or Apple notarization. macOS may report that the developer cannot be verified or the app cannot be opened.
After downloading from this project’s GitHub Releases and verifying that you trust the app, move Norna Studio to Applications. Open Terminal and run:
xattr -dr com.apple.quarantine "/Applications/Norna Studio.app"
Then open Norna Studio again. This command removes the download quarantine attribute from this app. If you installed it elsewhere, replace the path with its actual location. It does not repair an incomplete or damaged download.
Installation and first-launch helpResources
- DocumentationRequirements, integration, inline content and Studio.
- Windows guideC# libraries, Win2D drawing, export and packaging.
- Support notesSupported constructs and current limits per family.
- GitHubSource code, issues and releases.
- ChangelogWhat changed in each library release.
- CreditsThird-party notices and acknowledgments.