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" />
<PackageReference Include="HighLightHtml" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=HighLightHtml&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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">"function"</span>);
Console.WriteLine(htmlA);
<span class="hljs-keyword">var</span> htmlB = <span class="hljs-keyword">new</span> HighLight().GetHtml(<span class="hljs-string">"function"</span>);
Console.WriteLine(htmlB);
}
}
Product | Versions 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.
-
net8.0
- Microsoft.ClearScript.V8 (>= 7.4.4)
- Microsoft.ClearScript.V8.Native.win-x64 (>= 7.4.4)
- Microsoft.ClearScript.V8.Native.win-x86 (>= 7.4.4)
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 |