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
                    
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="Meziantou.Framework.HumanReadableSerializer.Html" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.HumanReadableSerializer.Html" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer.Html" />
                    
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 Meziantou.Framework.HumanReadableSerializer.Html --version 1.0.0
                    
#r "nuget: Meziantou.Framework.HumanReadableSerializer.Html, 1.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 Meziantou.Framework.HumanReadableSerializer.Html@1.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=Meziantou.Framework.HumanReadableSerializer.Html&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.HumanReadableSerializer.Html&version=1.0.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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