html-code-gen
v0.4.0
Published
html-code-gen ========
Downloads
1,585
Maintainers
Keywords
Readme
html-code-gen
html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.
Install
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');
Usage
htmlCodeGen.print(dom, opt);htmlCodeGen.printAsync(dom, opt).then(
output => console.log(output)
);Options
indent-size: size of indentdefault:
4indent-char: char of indent ( space / tab )default:
'space'max-char: max char num in one line (TODO)default:
80no-format-tag: tags whose content should not be formatteddefault:
spec.tagTypeMap.structuralno-format: no formatdefault:
falseinline-tag: tags whose content should be inlinedefault:
spec.tagTypeMap.inlineformatter: special formatters { tagName ( script / style ) : formater )default:
{}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 leveldefault:
0
Development
run test cases
npm run testbuild for browser
npm run browser
