HrefWizard 3.0.0
dotnet add package HrefWizard --version 3.0.0
NuGet\Install-Package HrefWizard -Version 3.0.0
<PackageReference Include="HrefWizard" Version="3.0.0" />
<PackageVersion Include="HrefWizard" Version="3.0.0" />
<PackageReference Include="HrefWizard" />
paket add HrefWizard --version 3.0.0
#r "nuget: HrefWizard, 3.0.0"
#:package HrefWizard@3.0.0
#addin nuget:?package=HrefWizard&version=3.0.0
#tool nuget:?package=HrefWizard&version=3.0.0
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"andrel="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): Iftrue, addstarget="_blank"to the link, making it open in a new tab. Defaults tofalse.relNoFollow(bool): Iftrue, addsrel="nofollow"to the link. Defaults tofalse.
(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 | Versions 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. |
-
.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 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.