WordbreakMiddleware 0.0.0-alpha.0.3
See the version list below for details.
dotnet add package WordbreakMiddleware --version 0.0.0-alpha.0.3
NuGet\Install-Package WordbreakMiddleware -Version 0.0.0-alpha.0.3
<PackageReference Include="WordbreakMiddleware" Version="0.0.0-alpha.0.3" />
<PackageVersion Include="WordbreakMiddleware" Version="0.0.0-alpha.0.3" />
<PackageReference Include="WordbreakMiddleware" />
paket add WordbreakMiddleware --version 0.0.0-alpha.0.3
#r "nuget: WordbreakMiddleware, 0.0.0-alpha.0.3"
#:package WordbreakMiddleware@0.0.0-alpha.0.3
#addin nuget:?package=WordbreakMiddleware&version=0.0.0-alpha.0.3&prerelease
#tool nuget:?package=WordbreakMiddleware&version=0.0.0-alpha.0.3&prerelease
WordbreakMiddleware
ASP.NET Core middleware that automatically adds word-break opportunities to long words containing dots in HTML content. This helps prevent layout issues with long domain names, file paths, and similar text that would otherwise overflow their containers.
Installation
dotnet add package WordbreakMiddleware
Quick Start
Add the middleware to your ASP.NET Core pipeline:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Add WordbreakMiddleware to the pipeline
app.UseWordBreakMiddleware();
app.Run();
How It Works
The middleware intercepts HTML responses and inserts <wbr>
(word break opportunity) tags after dots in long words. For example:
verylongdomainname.example.com
becomesverylongdomainname.<wbr>example.<wbr>com
some.really.long.file.path.txt
becomessome.<wbr>really.<wbr>long.<wbr>file.<wbr>path.<wbr>txt
By default, only words with 20+ characters in heading elements (h1-h6) are processed.
Configuration
Customize the middleware behavior:
app.UseWordBreakMiddleware(options =>
{
// Minimum word length to process (default: 20)
options.MinimumCharacters = 15;
// Characters to insert at break points (default: "<wbr>")
options.WordBreakCharacters = "<wbr>";
// Process only HTML content (default: true)
options.ProcessHtmlOnly = true;
// CSS selector for elements to process (default: "h1, h2, h3, h4, h5, h6")
options.CssSelector = "h1, h2, h3, h4, h5, h6, .text-break";
});
License
MIT
Product | Versions 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 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. |
-
net9.0
- AngleSharp (>= 1.3.1-beta.491)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
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 |
---|---|---|
0.0.0-alpha.0.4 | 188 | 8/5/2025 |
0.0.0-alpha.0.3 | 116 | 8/4/2025 |
0.0.0-alpha.0.2 | 120 | 8/4/2025 |
0.0.0-alpha.0.1 | 43 | 8/1/2025 |
0.0.0-alpha.0 | 233 | 7/26/2025 |