HrefWizard 3.0.0

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

HrefWizard 🪄✨

HrefWizard is a simple .NET library that automatically adds HTML anchor tags (<a>) to specific keywords within a given text. Define your keywords and URLs, and let the wizard do the rest!

Features ✨

  • Automatic Linking: Finds defined keywords in text and wraps them with <a> tags.
  • Case-Insensitive: Matches keywords regardless of their casing by default.
  • Whole Word Matching: Prevents partial matches within words (e.g., won't link "cat" inside "caterpillar").
  • Preserves Original Case: Keeps the original capitalization of the matched keyword in the link text.
  • Configurable Links: Options to add target="_blank" and rel="nofollow" attributes.
  • Simple API: Easy to add link definitions and process text.
  • Framework Compatibility: Targets .NET Standard 2.0 for broad compatibility (.NET Framework, .NET Core, .NET 5+).

Installation 📦

Install the package via NuGet Package Manager:

Install-Package HrefWizard

Or via the .NET CLI:

dotnet add package HrefWizard

Basic Usage 🚀

using System;
using HrefWizard; // Add this using statement

public class Example
{
    public static void Main(string[] args)
    {
        // 1. Create a wizard instance
        var wizard = new HrefWizard();

        // 2. Add link definitions
        wizard.AddLink("google", "[https://www.google.com](https://www.google.com)");
        wizard.AddLink("nuget", "[https://www.nuget.org](https://www.nuget.org)", targetBlank: true);
        wizard.AddLink("Microsoft", "[https://www.microsoft.com](https://www.microsoft.com)", relNoFollow: true);
        wizard.AddLink("OpenAI", "[https://openai.com](https://openai.com)", targetBlank: true, relNoFollow: true);

        // 3. Process your text
        string inputText = "Search on Google for the latest Microsoft products or find packages on NuGet. Check out OpenAI too.";
        string linkedText = wizard.ProcessText(inputText);

        // 4. Use the result
        Console.WriteLine(linkedText);
        // Output:
        // Search on <a href="[https://www.google.com](https://www.google.com)">Google</a> for the latest <a href="[https://www.microsoft.com](https://www.microsoft.com)" rel="nofollow">Microsoft</a> products or find packages on <a href="[https://www.nuget.org](https://www.nuget.org)" target="_blank">NuGet</a>. Check out <a href="[https://openai.com](https://openai.com)" target="_blank" rel="nofollow">OpenAI</a> too.
    }
}

Configuration Options⚙️

When adding links using AddLink, you can specify:

  • targetBlank (bool): If true, adds target="_blank" to the link, making it open in a new tab. Defaults to false.
  • relNoFollow (bool): If true, adds rel="nofollow" to the link. Defaults to false.

(Note: Case sensitivity and whole word matching are currently handled by default logic but could become configurable options in future versions).

Future Improvements (Roadmap) 🗺️

  • HTML Awareness: Implement smarter parsing to avoid adding links inside existing HTML tags (e.g., within <a>, <img>, <pre>, <code> tags).
  • More Configuration: Add options for case sensitivity, whole word matching toggles, and custom CSS classes for links.
  • Performance: Optimize the replacement logic for very large texts or large numbers of keywords.

Contributing🤝

Contributions, issues, and feature requests are welcome! Feel free to check issues page.

License 📄

This project is licensed under the Apache-2.0 license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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
3.0.0 367 10/28/2025
2.0.0 176 10/28/2025
1.0.0 183 10/28/2025

- Version 3.0.0:

- Initial release of HrefWizard.

- Provides functionality to automatically add HTML <a> tags to specified keywords within text.

- Supports case-insensitive, whole-word matching.

- Preserves the original casing of the keyword in the link text.

- Includes options to add target="_blank" and rel="nofollow" attributes to generated links.