bump to 0.4.0
html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.
nodejs
npm install html-code-gen
```javascript var 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
indent-size
default: 4
4
indent-char: char of indent ( space / tab )
indent-char
default: 'space'
'space'
max-char: max char num in one line (TODO)
max-char
default: 80
80
no-format-tag: tags whose content should not be formatted
no-format-tag
default: spec.tagTypeMap.structural
spec.tagTypeMap.structural
no-format: no format
no-format
default: false
false
inline-tag: tags whose content should be inline
inline-tag
default: spec.tagTypeMap.inline
spec.tagTypeMap.inline
formatter: special formatters { tagName ( script / style ) : formater )
formatter
default: {}
{}
bool-attribute-value: hide value of boolean attribute or not ( ‘remove’ / ‘preserve’ )
bool-attribute-value
default: 'remove'
'remove'
self-close: should void tags close themeselves with “/“ ( ‘close’ / ‘no-close’ )
self-close
default: 'no-close'
'no-close'
level: current level
level
default: 0
0
run test cases
npm run test
build for browser
npm run browser
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
html-code-gen
html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.
Install
nodejs
browser (UMD bundle generated by browserify)
global
AMD
Usage
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:
0Development
run test cases
build for browser