antihtml
v0.2.0
Published
Simple structured HTML serializer
Downloads
131
Readme
AntiHTML
The simple stupid data structure oriented HTML serializer.
Simple exaple
import { el, htmlDocument, prettify } from 'antihtml';
const title = "Hello world";
const document = el('html',
el('head',
el('meta', {'charset': 'utf-8'}),
el('title', title),
),
el('body',
el('h1', title),
el('p', "This is a sample html document"),
),
);
const html = htmlDocument(prettify(document, " "));
The produced html
string is the following:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello world</title>
</head>
<body>
<h1>Hello world</h1>
<p>This is a sample html document</p>
</body>
</html>