# html-code-gen **Repository Path**: mirrors_ecomfe/html-code-gen ## Basic Information - **Project Name**: html-code-gen - **Description**: HTML-code generator - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README html-code-gen ======== [![Build Status](https://img.shields.io/travis/ecomfe/html-code-gen.svg?style=flat)](http://travis-ci.org/ecomfe/html-code-gen) [![NPM version](https://img.shields.io/npm/v/html-code-gen.svg?style=flat)](https://www.npmjs.com/package/html-code-gen) [![Coverage Status](https://img.shields.io/coveralls/ecomfe/html-code-gen.svg?style=flat)](https://coveralls.io/r/ecomfe/html-code-gen) [![Dependencies](https://img.shields.io/david/ecomfe/html-code-gen.svg?style=flat)](https://david-dm.org/ecomfe/html-code-gen) [![DevDependencies](https://img.shields.io/david/dev/ecomfe/html-code-gen.svg?style=flat)](https://david-dm.org/ecomfe/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-gen ```javascript var htmlCodeGen = require('html-code-gen'); ``` * browser (UMD bundle generated by browserify) * global ```html ``` ```javascript var htmlCodeGen = window.htmlCodeGen; ``` * AMD ```javascript var htmlCodeGen = require('html-code-gen'); ``` ### Usage ```javascript htmlCodeGen.print(dom, opt); ``` ```javascript 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