FriendToNetWebDevelopers.HtmlAttributeDictionary 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FriendToNetWebDevelopers.HtmlAttributeDictionary --version 1.0.1
NuGet\Install-Package FriendToNetWebDevelopers.HtmlAttributeDictionary -Version 1.0.1
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="FriendToNetWebDevelopers.HtmlAttributeDictionary" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FriendToNetWebDevelopers.HtmlAttributeDictionary --version 1.0.1
#r "nuget: FriendToNetWebDevelopers.HtmlAttributeDictionary, 1.0.1"
#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.
// Install FriendToNetWebDevelopers.HtmlAttributeDictionary as a Cake Addin
#addin nuget:?package=FriendToNetWebDevelopers.HtmlAttributeDictionary&version=1.0.1

// Install FriendToNetWebDevelopers.HtmlAttributeDictionary as a Cake Tool
#tool nuget:?package=FriendToNetWebDevelopers.HtmlAttributeDictionary&version=1.0.1

HTML Attribute Dictionary

Summary

A dictionary which extends Dictionary<string,string> and provides html attribute and value safety features.

Installation

NuGet\Install-Package FriendToNetWebDevelopers.HtmlAttributeDictionary -Version 1.0.1

Usage

This is the simplest use case I could come up with.

@{  //                                 Please note the multiple classes being brought in
    //                                          Along with your id ↓         ↓
    //                                                      ↓      ↓         ↓
    var dictionary = HtmlAttributeDictionaryFactory.WithId("foo", "some-hero bar");
    if(needsScrim)
    {
        dictionary.AddClassToClassAttribute("hero-scrim");
    }
}
<section>
    
    <div @Html.Raw(dictionary)>
        
    </div>
</section>

This keeps things simple and safe. It even allows for data to come in from an unsafe source and be safe to display.

It even prevents invalid attributes from being added.

License Information

HTML Attribute Dictionary by Christopher Goehrs through Friend to .NET Web Developers is licensed under CC BY 4.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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
1.2.5 63 6/24/2024
1.2.4 60 6/24/2024
1.2.3 62 6/7/2024
1.2.2 69 6/7/2024
1.2.1 74 6/5/2024
1.2.0 95 5/29/2024
1.1.0 85 5/28/2024
1.0.1 88 5/27/2024