0.4.0 • Published 8 years ago

html-code-gen v0.4.0

Weekly downloads
796
License
MIT
Repository
github
Last release
8 years ago

html-code-gen

Build Status NPM version Coverage Status Dependencies DevDependencies

html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.

Install

  • nodejs

    		npm install html-code-gen
```javascript
var htmlCodeGen = require('html-code-gen');
```
  • browser (UMD bundle generated by browserify)

    	* global
    
    		```html
    		<script src="html-code-gen/browser/html-code-gen.min.js"></script>
    		```
    
    		```javascript
    		var htmlCodeGen = window.htmlCodeGen;
    		```
    
    	* AMD
    
    		```javascript
    		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 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`](./lib/spec.js#L26)
  • no-format: no format

    	default: `false`
  • inline-tag: tags whose content should be inline

    	default: [`spec.tagTypeMap.inline`](./lib/spec.js#L25)
  • formatter: 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 level

    	default: `0`

Development

  • run test cases

    		npm run test
  • build for browser

    		npm run browser
0.4.0

8 years ago

0.3.7

10 years ago

0.3.6

10 years ago

0.3.5

10 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago