1.0.9 • Published 9 months ago
nvhtml2-simple-writer v1.0.9
nvhtml2-simple-writer
- a simple html writer for repl-tools
- without using parser, just concat string
- its slow. only use it in repl/cli tools.
install
- npm install nvhtml2-simple-writer
splitted
usage
const {...} = require("nvhtml2-simple-writer").html;
const {...} = require("nvhtml2-simple-writer").ntac;
example
const {
html,
head,link,title,
body,
div,
_show,
} = require("nvhtml2-simple-writer").html
var html_text = html(
head(
link({rel:"stylesheet",href:"https://xxx.css"}),
title("str-means-a-text-node")
),
body(
{"key":"dict-means-attribs"},
2,div( // prev int menas repeat
"text0",
"text1",
"text2",
),
div(
{"k0":"v0","k1":"v1"},
div(),
3, "this-is-text" , // 3 child text-node with content "this-is-text"
div(),
)
)
)
console.log(_show(html_text))
/*
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://xxx.css">
</link>
<title>
str-means-a-text-node
</title>
</head>
<body key="dict-means-attribs">
<div>
text0
text1
text2
</div>
<div>
text0
text1
text2
</div>
<div k0="v0" k1="v1">
<div>
</div>
this-is-text
this-is-text
this-is-text
<div>
</div>
</div>
</body>
</html>
*/
METHODS
APIS
LICENSE
- ISC