0.0.1 • Published 9 months ago
nvhtml2-tree-writer v0.0.1
nvhtml2-tree-writer
- same as nvhtml2-simple-writer, instead output str , this will create nodes
install
- npm install nvhtml2-tree-writer
splitted
usage
const _w = require("nvhtml2-tree-writer");
const {
a,abbr,address,area,article,aside,audio,
b,base,bdi,bdo,big,blockquote,body,br,button,
canvas,caption,cite,code,col,colgroup,command,
datalist,dd,del,details,dfn,dialog,div,dl,dt,
em,embed,
fieldset,figcaption,figure,footer,form,
h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,
i,iframe,ilayer,img,input,ins,
kbd,keygen,
label,legend,li,link,
main,map,mark,marquee,menu,meta,meter,
nav,noscript,
object,ol,optgroup,option,output,
p,param,pre,progress,
q,
rp,rt,ruby,
samp,script,section,select,small,source,span,strong,style,sub,summary,sup,
table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,
ul,
video,
wbr
} = _w;
const vvar = _w.var;
const {_show} = _w;
example
var nd = 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(nd))
/*
<!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
0.0.1
9 months ago