Linkernizer 1.0.5

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

Linkernizer

Welcome to Linkernizer, the (possibly best) .NET library for automatically linking URLs and email addresses.
It takes in plain text and wraps anything it considers a link with the HTML markup for a hyperlink / anchor.

You can use it like this:

var linkernizer = new Linkernizer();
var input = "Visit us at www.example.org or email us at mail@example.org!";
var output = linkernizer.Linkernize(input);
// Visit us at <a href="https://www.example.org">www.example.org</a> or email us at <a href="mailto:mail@example.org">mail@example.org</a>!

You can configure a few additional options like this:

var linkernizer = new Linkernizer(options => {
  options.OpenExternalLinksInNewTab = true; // inserts target="_blank"
  options.InternalHost = "www.example.com"; // do not insert target="_blank" on these links
  options.DefaultScheme = "http://"; // use this scheme for links starting with www.
});

Why should I use or not use Linkernizer?

You should use it because:

  • It is fast (see the benchmarks below for more details)
  • It uses little memory (there are zero allocations after the setup when the input does not contain links)
  • It has only one dependency (to Microsoft.SourceLink.GitHub, which is only a build-time dependency)
  • It provides an interface so that it can be used via dependency injection

However, there are also some limitations:

  • Links are not validated against a full list of top-level domains (as this list will be outdated quickly)
  • Links are not validated against a full list of URI schemes (as these could change quickly as well)
  • Telephone numbers are not linked automatically (as this usually generates too many false positives for my taste)
  • It assumes the input does not already contain HTML (and will likely lead to invalid markup if this is not the case)

Installation

The library can be used like any other NuGet package. For example:

> dotnet add package Linkernizer

You can find more information on https://www.nuget.org/packages/Linkernizer.

Benchmarks

The benchmarks compare the following libraries in their default configuration:

The execution time (excluding initial setup):

Execution time

The memory allocated (excluding initial setup):

Memory allocated

Keep in mind that the exact values will vary from run to run.

| Method                         | Mean         | Error      | StdDev     | Gen0   | Allocated |
|------------------------------- |-------------:|-----------:|-----------:|-------:|----------:|
| LinkernizerShortTextNoMatches  |     10.04 ns |   0.031 ns |   0.028 ns |      - |         - |
| LinkernizerLongTextNoMatches   |     38.89 ns |   0.104 ns |   0.092 ns |      - |         - |
| LinkernizerShortTextTwoMatches |    644.91 ns |   4.310 ns |   3.599 ns | 0.1411 |     592 B |
| LinkernizerLongTextFourMatches |  3,248.53 ns |  15.657 ns |  13.880 ns | 0.5493 |    2312 B |
|------------------------------- |-------------:|-----------:|-----------:|-------:|----------:|
| AutoLinkShortTextNoMatches     |  1,112.75 ns |   3.894 ns |   3.643 ns | 0.0210 |      88 B |
| AutoLinkLongTextNoMatches      |  8,240.50 ns |  63.245 ns |  56.065 ns | 0.0153 |      88 B |
| AutoLinkShortTextTwoMatches    |  1,752.95 ns |   6.943 ns |   5.798 ns | 0.2937 |    1232 B |
| AutoLinkLongTextFourMatches    |  9,930.48 ns | 103.320 ns |  96.645 ns | 2.0142 |    8448 B |
|------------------------------- |-------------:|-----------:|-----------:|-------:|----------:|
| TextHelperShortTextNoMatches   |  2,860.00 ns |   9.203 ns |   7.185 ns | 0.0381 |     168 B |
| TextHelperLongTextNoMatches    | 20,015.26 ns |  33.143 ns |  25.876 ns | 0.0305 |     168 B |
| TextHelperShortTextTwoMatches  |  3,962.34 ns |  35.980 ns |  30.045 ns | 0.2441 |    1040 B |
| TextHelperLongTextFourMatches  | 22,227.44 ns | 123.171 ns | 115.214 ns | 0.7324 |    3136 B |

You can verify the results by running the same benchmarks on your machine.

Product 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 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.
  • net9.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
1.0.5 95 4/29/2026
1.0.4 87 4/29/2026
1.0.3 97 4/9/2026
1.0.2 116 2/27/2026
1.0.1 199 6/23/2025
1.0.0 212 6/23/2025