PugConverter 1.0.0
dotnet add package PugConverter --version 1.0.0
NuGet\Install-Package PugConverter -Version 1.0.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="PugConverter" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PugConverter" Version="1.0.0" />
<PackageReference Include="PugConverter" />
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 PugConverter --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PugConverter, 1.0.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 PugConverter@1.0.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=PugConverter&version=1.0.0
#tool nuget:?package=PugConverter&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PugConverter
PugConverter is a lightweight C# library designed to convert Pug templates into HTML and Markdown. It provides a simple API for tokenizing, parsing, and generating output from Pug syntax.
Features
- Pug to HTML: Converts standard Pug syntax to valid HTML.
- Pug to Markdown: Converts generated HTML to Markdown.
- Lexer & Parser: built-in robust parsing for Pug templates.
- Lightweight: Minimal dependencies.
Installation
You can install the package via NuGet:
dotnet add package PugConverter
Usage
Converting Pug to HTML
using PugLib;
string pugContent = @"
doctype html
html(lang='en')
head
title My Page
body
h1 Hello, World!
p This is a paragraph.
";
var lexer = new Lexer(pugContent);
var tokens = lexer.Tokenize();
var parser = new Parser(tokens);
var ast = parser.Parse();
var generator = new Generator();
string html = generator.Generate(ast);
Console.WriteLine(html);
Converting Pug to Markdown
using PugLib;
string markdown = HtmlToMarkdownConverter.Convert(html);
Console.WriteLine(markdown);
Supported Syntax
- Tags (
div,p,h1, etc.) - Attributes (
(src="..."),(class="...")) - Classes (
.classname) - IDs (
#idname) - Text content
- Nesting/Indentation
License
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net9.0
- ReverseMarkdown (>= 5.0.0)
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 |
|---|---|---|
| 1.0.0 | 181 | 2/1/2026 |