antihtml

0.2.0 • Public • Published

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>

Readme

Keywords

Package Sidebar

Install

npm i antihtml

Weekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

18.7 kB

Total Files

6

Last publish

Collaborators

  • hornwitser