Lokad.Markdownify 0.1.0

Prefix Reserved
dotnet add package Lokad.Markdownify --version 0.1.0
                    
NuGet\Install-Package Lokad.Markdownify -Version 0.1.0
                    
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="Lokad.Markdownify" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lokad.Markdownify" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Lokad.Markdownify" />
                    
Project file
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 Lokad.Markdownify --version 0.1.0
                    
#r "nuget: Lokad.Markdownify, 0.1.0"
                    
#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 Lokad.Markdownify@0.1.0
                    
#: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=Lokad.Markdownify&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Lokad.Markdownify&version=0.1.0
                    
Install as a Cake Tool

Lokad.Markdownify

Lokad.Markdownify is a small, dependency-free .NET library that converts a standalone HTML document or fragment to readable Markdown. Its primary use case is preparing HTML email bodies for agentic and text-oriented processing.

dotnet add package Lokad.Markdownify

Design goals

  • No runtime package dependencies.
  • Strictly linear time and memory in the input size.
  • No recursive parsing or rendering.
  • Deterministic, culture-independent output.
  • Graceful recovery from arbitrary malformed HTML.
  • Low allocation pressure: source slices and compact structural events instead of a DOM.
  • No JavaScript execution, CSS layout, network access, or external-resource loading.

The converter is deliberately not a browser and not an HTML sanitizer. It extracts readable content; callers that render untrusted output in a security-sensitive context must apply the protections required by that renderer.

API

using Lokad;

string markdown = Markdownify.Convert("<p>Hello <strong>world</strong>.</p>");

Expected result:

Hello **world**.

See the conversion specification and the architecture note for the v1 contract under development.

The performance note describes the linearity argument, reproducible diagnostic harness, and current local baseline.

Building

The .NET 10 SDK is required.

dotnet restore
dotnet build --no-restore
dotnet test --no-build

The named-entity table is generated from Python's HTML5 entity catalog and is committed to the repository:

python tools/generate_html_named_entities.py

NuGet packages must be produced in Release configuration and are written to artifacts/nuget/:

dotnet pack src/Lokad.Markdownify/Lokad.Markdownify.csproj --configuration Release --no-build

License

Lokad.Markdownify is available under the MIT License.

Product 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

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 148 7/20/2026

Initial dependency-free, non-recursive HTML-to-Markdown converter focused on malformed and email HTML.