Generate static HTML documents using a powerful API, write a complete site to disk or host it with OWIN (Library, C#/.NET Standard 1.3)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
source/Nerven.Htmler
tests/Nerven.Htmler.Tests
.gitignore
GitVersionConfig.yaml
LICENSE.txt
Nerven.DotSettings
Nerven.Htmler.sln
Nerven.Htmler.sln.DotSettings
README.md
Settings.StyleCop
appveyor.yml
build.cmd
build.complete.cmd
build.proj
build.test.cmd
pre-build.cmd

README.md

Powerful and extandable HTML generation library in C# using .NET Standard 1.3

using static Nerven.Htmler.Core.HtmlBuilder;

var document = Document(
    htmlTag(
        headTag(
            metaTag(
                charsetAttr(Encoding.UTF8)),
            titleTag(
                Text("Htmler Demo"))),
        bodyTag(
            divTag(
                Comment("makes it easy -- really easy -- to generate HTML correctly and securily --> (look, this comment is properly escaped)"),
                pTag(
                    idAttr("paragraph-with-id"),
                    classAttr("important-paragraph"),
                    Raw("you are wrong and I'm right, this shouldn't be escaped: <<< (while inheretly secure, Htmler doesn't stop when you insist)"),
                    divTag(
                        Text("Supports flag attributes"),
                        inputTag(Attribute("disabled", null)),
                        buttonTag(Attribute("disabled", null))),
                    aTag(
                        imgTag(
                            Attribute("src", "test.png")),
                        spanTag(Text("It's > with escaped text!"))))),
            pTag(
                Text("Well, to avoid issues with whitespace affecting layout, "),
                Text("default mode generates no whitespace or newlines at all, "),
                Text("but one can turn on some newlines if needed.")))));

var s = document.WriteReadableToString();

becomes

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Htmler Demo</title>
</head>
<body>
<div>
<!--makes it easy - - really easy - - to generate HTML correctly and securily - -> (look, this comment is properly escaped)-->
<p id="paragraph-with-id" class="important-paragraph">you are wrong and I'm right, this shouldn't be escaped: <<< (while inheretly secure, Htmler doesn't stop when you insist)
<div>Supports flag attributes
<input disabled>
<button disabled></button>
</div>
<a>
<img src="test.png">
<span>It's &gt; with escaped text!</span>
</a>
</p>
</div>
<p>Well, to avoid issues with whitespace affecting layout, default mode generates no whitespace or newlines at all, but one can turn on some newlines if needed.</p>
</body>
</html>