package
html-code-gen ========
npm install html-code-genGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.
nodejs
npm install html-code-genvar htmlCodeGen = require('html-code-gen');browser (UMD bundle generated by browserify)
global
<script src="html-code-gen/browser/html-code-gen.min.js"></script>var htmlCodeGen = window.htmlCodeGen;AMD
var htmlCodeGen = require('html-code-gen');htmlCodeGen.print(dom, opt);htmlCodeGen.printAsync(dom, opt).then(
output => console.log(output)
);indent-size: size of indent
default: 4
indent-char: char of indent ( space / tab )
default: 'space'
max-char: max char num in one line (TODO)
default: 80
no-format-tag: tags whose content should not be formatted
default: spec.tagTypeMap.structural
no-format: no format
default: false
inline-tag: tags whose content should be inline
default: spec.tagTypeMap.inline
: special formatters { tagName ( script / style ) : formater )
run test cases
npm run testbuild for browser
npm run browserzttonly
zttonly@gmail.com
100pah
sushuang0322@gmail.com
ecomfe-core
ecomfe@gmail.com
ecomfe-admin
ecomfe@gmail.com
otakustay
otakustay@gmail.com
leeight
leeight@gmail.com
justineo
justice360@gmail.com
gdjinbo
wfsr@foxmail.com
luyuan
luyuan.china@gmail.com
errorrik
errorrik@gmail.com
ksky521
ksky521@gmail.com
lang
shenyi.914@gmail.com
jinzhan
steinitz@qq.com
nighca
nighca@live.cn
formatterdefault: {}
bool-attribute-value: hide value of boolean attribute or not ( 'remove' / 'preserve' )
default: 'remove'
self-close: should void tags close themeselves with "/" ( 'close' / 'no-close' )
default: 'no-close'
level: current level
default: 0