HighLightHtml 1.0.0

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

HighLightHtml

A simple .NET library that generates syntax-highlighted HTML code using highlight.js.

It’s useful when you want to render highlighted code on the server side, rather than relying on client-side rendering.

Usage

var html = new HighLight().GetHtml("function a()");
Console.WriteLine(html);

Output:

<span class="hljs-keyword">function</span> <span class="hljs-title function_">a</span>(<span class="hljs-params"></span>)

Highlighting with Language Specified

var html = new HighLight().GetHtml("cs", @"using HighLightHtml;

namespace TestProject;

[TestClass]
public class UnitTest1
{
	[TestMethod]
	public void TestMethod1()
	{
		var htmlA = new HighLight().GetHtml(""function"");
		Console.WriteLine(htmlA);

		var htmlB = new HighLight().GetHtml(""function"");
		Console.WriteLine(htmlB);
	}
}");
Console.WriteLine(html);

Output:

<span class="hljs-keyword">using</span> HighLightHtml;

<span class="hljs-keyword">namespace</span> <span class="hljs-title">TestProject</span>;

[<span class="hljs-meta">TestClass</span>]
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title">UnitTest1</span>
{
        [<span class="hljs-meta">TestMethod</span>]
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">TestMethod1</span>()</span>
        {
                <span class="hljs-keyword">var</span> htmlA = <span class="hljs-keyword">new</span> HighLight().GetHtml(<span class="hljs-string">&quot;function&quot;</span>);
                Console.WriteLine(htmlA);

                <span class="hljs-keyword">var</span> htmlB = <span class="hljs-keyword">new</span> HighLight().GetHtml(<span class="hljs-string">&quot;function&quot;</span>);
                Console.WriteLine(htmlB);
        }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.

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 114 7/9/2025