v0.2.0macOS 14+ · Windows 11MIT

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")
An idea becomes Mermaid source, then a native diagram and an SVG exportAn idea becomes Mermaid source, then a native diagram and an SVG export
Actual native output from NornaKit, shown here as a screenshot.

Quick start

Three steps from Mermaid text to a diagram inside your app.

  1. Add the library

    Swift Package Manager on macOS. Project references to NornaKit.Core and NornaKit.Windows on Windows.

  2. Render the source

    The renderer parses Mermaid, measures text natively and lays the diagram out into an immutable scene.

  3. 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)

Platforms

Two independent native implementations that share the same diagram families and layout model.

macOSWindows
LanguageSwift 6C# · .NET 10
SystemmacOS 14+Windows 11 (build 22000+), x64 and ARM64
TextCoreTextDirectWrite
DrawingCoreGraphicsWin2D
ExportPNG · JPEG · TIFF · SVG · PDFPNG · JPEG · TIFF · SVG · PDF
Inline icons:sf:name: SF Symbols:win:name: Segoe Fluent Icons
IntegrationSwift Package ManagerProject references (NuGet coming later)
Companion appNorna Studio, Apple SiliconWinUI 3 workbench, not yet released
GuidemacOS 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.

Flowchart
Download .mmd

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

Download for Mac
Homebrew
brew install --cask dufu1991/tap/norna-studio
Blocked 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 help

Resources

Native output