LiveMarkdown.Avalonia.WaveDrom
0.1.1
dotnet add package LiveMarkdown.Avalonia.WaveDrom --version 0.1.1
NuGet\Install-Package LiveMarkdown.Avalonia.WaveDrom -Version 0.1.1
<PackageReference Include="LiveMarkdown.Avalonia.WaveDrom" Version="0.1.1" />
<PackageVersion Include="LiveMarkdown.Avalonia.WaveDrom" Version="0.1.1" />
<PackageReference Include="LiveMarkdown.Avalonia.WaveDrom" />
paket add LiveMarkdown.Avalonia.WaveDrom --version 0.1.1
#r "nuget: LiveMarkdown.Avalonia.WaveDrom, 0.1.1"
#:package LiveMarkdown.Avalonia.WaveDrom@0.1.1
#addin nuget:?package=LiveMarkdown.Avalonia.WaveDrom&version=0.1.1
#tool nuget:?package=LiveMarkdown.Avalonia.WaveDrom&version=0.1.1
LiveMarkdown.Avalonia.WaveDrom
An extension package for LiveMarkdown.Avalonia that natively renders WaveDrom timing diagrams (digital waveform diagrams), written in Markdown code fences, as Avalonia controls without a JavaScript runtime or WebView.
This package is an extension of LiveMarkdown.Avalonia (the Markdown renderer for Avalonia). It does not work on its own — it plugs into
LiveMarkdown.Avaloniato add```wavedromsupport. For the core Markdown rendering features, please refer to the LiveMarkdown.Avalonia repository.
The official WaveDrom rendering logic (layout, brick skins, markers, arrows,
etc.) has been ported to C# and is drawn directly via DrawingContext.
Features
- 🔌 Markdown integration — Detects
```wavedromfences and renders them as waveform diagrams. - 🧩 Native rendering — No JS / WebView required. Runs on pure C# + Avalonia only.
- 🎨 Official skin compliant — Supports the official default skin's brick definitions
(
pclk/nclk/vvv-N/xm*, etc.) and text class colors (info/muted/error/warning/success, headingsh1–h6). - 🔄 Streaming support — Shows the source text while the fence is open, and switches to the rendered waveform diagram once it is closed.
- 🧮 Rich feature set — signal / data / node / edge (arrows) / group / gaps (vertical lines and brackets) / head / foot (tick/tock/every, tspan rich text) / config (hscale, marks, hbounds, arcFontSize).
Installation
dotnet add package LiveMarkdown.Avalonia.WaveDrom
The LiveMarkdown.Avalonia
core package is required (this package depends on it).
Adding to LiveMarkdown
To enable WaveDrom, perform the following three steps.
1. Register the extension in the pipeline
Add UseWaveDrom() to MarkdownRenderer.ConfigurePipeline.
using LiveMarkdown.Avalonia;
MarkdownRenderer.ConfigurePipeline += pipeline => pipeline
.UseWaveDrom();
It can be used together with other extensions such as UseMermaid() and
UseExtendedMathematics().
2. Register the node factory
Register WaveDromBlockNode (the node that converts a fence into an actual control).
MarkdownNode.Edit(builder => builder
.Register<WaveDromBlockNode>()
);
To register multiple nodes at once:
MarkdownNode.Edit(builder => builder
.Register<MermaidBlockNode>()
.Register<WaveDromBlockNode>()
);
3. Load the styles
Include the bundled Styles.axaml in your app's App.axaml (or the relevant Styles).
<Application.Styles>
<StyleInclude Source="avares://LiveMarkdown.Avalonia/Styles.axaml"/>
<StyleInclude Source="avares://LiveMarkdown.Avalonia.WaveDrom/Styles.axaml"/>
</Application.Styles>
Combined configuration example (App.axaml.cs)
public override void Initialize()
{
MarkdownRenderer.ConfigurePipeline += pipeline => pipeline
.UseMermaid()
.UseWaveDrom();
MarkdownNode.Edit(builder => builder
.Register<MermaidBlockNode>()
.Register<WaveDromBlockNode>());
AvaloniaXamlLoader.Load(this);
}
Usage
Write WaveDrom JSON (JavaScript-style object literals) inside a ```wavedrom
fence in your Markdown. The official WaveDrom "loose JSON" notation (unquoted
property names, single quotes, trailing commas) is also supported.
```wavedrom
{ signal: [
{ name: "clk", wave: "P......" },
{ name: "bus", wave: "x.==.=x", data: ["head", "body", "tail", "data"] },
{ name: "wire", wave: "0.1..0." }
]}
```
Main supported notation
| Feature | Example |
|---|---|
| Signal waveform | wave: "01.zx=ud.23.456789", "p", "n", "P", "N", "h", "l" |
| Bus data | wave: "x.345x", data: ["A", "B", "C"] |
| Clock | pclk / nclk / Pclk (with arrows) / Nclk |
| Groups | ['Master', [...]] / { name, signal: [...] } |
| Spacers | wave: "p.....|..." (| is a repeat / spacer) |
| head / foot | text / tick / tock / every / tspan rich text |
| Arrows / edges | node: '.a..j' + edge: ['a~b t1', 'c-~>d time 3', ...] |
| gaps shapes | gaps: "....|...." (vertical lines, brackets [/]/(/), etc.) |
| config | hscale, marks, hbounds, arcFontSize |
Arrow (edge) example
```wavedrom
{ signal: [
{ name: 'A', wave: '01........0....', node: '.a........j' },
{ name: 'B', wave: '0.1.......0.1..', node: '..b.......i' }
],
edge: [ 'a~b t1', 'a-~>b time 3' ]
}
```
Customization
WaveDromPresenter exposes styleable properties. You can override them to match
your theme through the Styles.axaml selector md|WaveDromPresenter.
<Style Selector="md|WaveDromPresenter">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundColor}"/>
<Setter Property="MarkerBrush" Value="{DynamicResource SecondaryCardBackgroundColor}"/>
</Style>
| Property | Description |
|---|---|
Text |
The WaveDrom JSON string to render. |
Foreground |
Base color for waveforms and text. |
FontFamily / FontSize |
Font for text in the diagram. |
BackgroundBrush |
Background of the whole diagram (transparent by default). |
MarkerBrush |
Fill for data boxes (theme color by default). |
Limitations
Some items are unsupported or approximate (see .agents/wavedrom-todo.md in the
repository for details).
- Slave signals (
wave: "s...") config.skin(other skins such as narrow / dark; brick dimensions differ from default)- Fill colors for skins other than default
- Automated verification of on-screen rendering (pixels)
Release (GitHub Actions)
Pushing a tag like v0.1.0 triggers the
Release workflow, which:
- restores, builds and packs the project in
Releaseconfiguration, - uploads the generated
.nupkgas a workflow artifact, - publishes the package to NuGet.org using NuGet Trusted Publishing (an OIDC-exchanged, short-lived API key — no long-lived secret is stored),
- creates a GitHub Release with the
.nupkgattached and auto-generated notes.
Trusted Publishing setup
No long-lived
NUGET_API_KEYis required. Instead, configure a trusted publishing policy on nuget.org and expose your nuget.org profile name asNUGET_USER:
- On nuget.org, go to Account settings → Trusted Publishing and add a policy for this repository (owner/repo) and the workflow file
.github/workflows/release.yml.- In GitHub, add
NUGET_USERunder Settings → Secrets and variables → Actions, set to your nuget.org profile name. It may be added on either the Variables tab (vars.NUGET_USER) or the Secrets tab (secrets.NUGET_USER) — the workflow reads whichever is present (variable takes precedence).The publish step only runs for tag pushes (
v*) or a manual dispatch with an explicit version;0.0.0-dev.*builds are never pushed. IfNUGET_USERis missing, the workflow fails early with a clear message.
git tag v0.1.0
git push origin v0.1.0
The workflow can also be started manually from the Actions tab
(workflow_dispatch) by supplying a version number.
License
Apache-2.0
References
- Repository: https://github.com/DearVa/LiveMarkdown.Avalonia
- Official WaveDrom: https://wavedrom.com/
| 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. |
-
net10.0
- Avalonia (>= 12.1.4)
- LiveMarkdown.Avalonia (>= 2.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.