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)

GitHub
github.com/Nerven/Htmler
License
MIT License
Source (git)
git@github.com:Nerven/Htmler.git
https://github.com/Nerven/Htmler.git
Source (archive)
.tar.gz
.zip
.NET platform
.NET Standard 1.3

Readme

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>

License

The MIT License (MIT)

Copyright © Victor Blomberg <victor.blomberg@nerven.se>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.