Meziantou.Framework.HumanReadableSerializer.Html
1.0.0
Prefix Reserved
dotnet add package Meziantou.Framework.HumanReadableSerializer.Html --version 1.0.0
NuGet\Install-Package Meziantou.Framework.HumanReadableSerializer.Html -Version 1.0.0
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer.Html" Version="1.0.0" />
<PackageVersion Include="Meziantou.Framework.HumanReadableSerializer.Html" Version="1.0.0" />
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer.Html" />
paket add Meziantou.Framework.HumanReadableSerializer.Html --version 1.0.0
#r "nuget: Meziantou.Framework.HumanReadableSerializer.Html, 1.0.0"
#:package Meziantou.Framework.HumanReadableSerializer.Html@1.0.0
#addin nuget:?package=Meziantou.Framework.HumanReadableSerializer.Html&version=1.0.0
#tool nuget:?package=Meziantou.Framework.HumanReadableSerializer.Html&version=1.0.0
Meziantou.Framework.HumanReadableSerializer.Html
Meziantou.Framework.HumanReadableSerializer.Html formats the HTML values (text/html) serialized by Meziantou.Framework.HumanReadableSerializer, such as the content of an HttpResponseMessage. The value is parsed by the spec-compliant HTML parser of Meziantou.Framework.WebPlatform and serialized back as defined by the HTML specification, so the output is normalized: the attribute values are quoted, the character references are decoded and re-escaped, and <br/> becomes <br>.
A value that contains a doctype or an html, head or body tag is parsed as a document. Any other value is parsed as the content of a body element, so it is not wrapped in <html><head></head><body>…</body></html>. A value that cannot be formatted is written as is.
Options
| Option | Description |
|---|---|
OrderAttributes |
Sorts the attributes of each element by namespace and name |
AttributeQuote |
DoubleQuote (the default) or SimpleQuote |
RedactContentSecurityPolicyNonce |
Replaces the value of the nonce attributes with [redacted] |
Usage
using Meziantou.Framework.HumanReadable;
using Meziantou.Framework.HumanReadable.ValueFormatters;
var options = new HumanReadableSerializerOptions()
.AddHtmlFormatter(new HtmlFormatterOptions
{
OrderAttributes = true,
RedactContentSecurityPolicyNonce = true,
});
var text = HumanReadableSerializer.Serialize(httpResponseMessage, options);
Meziantou.Framework.SnapshotTesting
using Meziantou.Framework.HumanReadable.ValueFormatters;
using Meziantou.Framework.SnapshotTesting;
internal static class SnapshotConfiguration
{
[ModuleInitializer]
internal static void Initialize()
{
SnapshotSettings.Default.ConfigureHumanReadableSerializer(options => options.AddHtmlFormatter(new HtmlFormatterOptions
{
OrderAttributes = true,
}));
}
}
Meziantou.Framework.InlineSnapshotTesting
using Meziantou.Framework.HumanReadable.ValueFormatters;
using Meziantou.Framework.InlineSnapshotTesting;
internal static class SnapshotConfiguration
{
[ModuleInitializer]
internal static void Initialize()
{
var settings = InlineSnapshotSettings.Default with { };
settings.UseHumanReadableSerializer(options => options.AddHtmlFormatter(new HtmlFormatterOptions
{
OrderAttributes = true,
}));
InlineSnapshotSettings.Default = settings;
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net11.0 is compatible. |
-
net10.0
- Meziantou.Framework.HumanReadableSerializer (>= 4.0.9)
- Meziantou.Framework.WebPlatform (>= 1.0.0)
-
net11.0
- Meziantou.Framework.HumanReadableSerializer (>= 4.0.9)
- Meziantou.Framework.WebPlatform (>= 1.0.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 |
|---|---|---|
| 1.0.0 | 0 | 10/19/2026 |