JJConsulting.Html provides a fluent, low-allocation, strongly typed API for constructing HTML in .NET.
It is suitable for scenarios where a templating engine is not desirable, and where full programmatic control is required.
dotnet add package JJConsulting.Html
var html =
new HtmlBuilder(HtmlTag.Div)
.WithCssClass("container")
.AppendDiv(d =>
d.WithCssClass("header")
.AppendText("Hello world!")
)
.AppendBr()
.AppendLink("Click here", "https://example.com")
.ToString(true);Produces:
<div class="container">
<div class="header">Hello world!</div>
<br />
<a href="https://example.com">Click here</a>
</div>Warning
Repository Moved
This repository has been moved to jjconsulting/jjmasterdata.
Please use the new repository to access the source code, follow updates, and report issues.