dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.46k stars 4.76k forks source link

[API Proposal]: Move `TagBuilder` into System.Text namespace #104090

Open vanillajonathan opened 5 months ago

vanillajonathan commented 5 months ago

Background and motivation

The TagBuilder class in ASP.NET Core is useful outside of the context of ASP.NET Core. I would like to be able to use it in console applications, desktop applications, microservices and libraries for things such as creating HTML email and reports in HTML format.

API Proposal

namespace System.Text.Html;

/// <summary>
/// Contains methods and properties that are used to create HTML elements.
/// </summary>
public class TagBuilder : IHtmlContent
{
    // ...
}

API Usage

var p = new TagBuilder("p");
p.SetContent("Hello world!");

Alternative Designs

No response

Risks

No response

dotnet-policy-service[bot] commented 5 months ago

Tagging subscribers to this area: @dotnet/area-meta See info in area-owners.md if you want to be subscribed.