@mewjs/html-code-gen
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

html-code-gen

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

Install

npm install @mewjs/html-code-gen
import htmlCodeGen from '@mewjs/html-code-gen';

Usage

htmlCodeGen.print(dom, opt);
htmlCodeGen.printAsync(dom, opt).then(console.log);

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

  • no-format: no format

    default: false

  • inline-tag: tags whose content should be inline

    default: spec.tagTypeMap.inline

  • formatter: special formatters { tagName ( script / style ) : formatter )

    default: {}

  • bool-attribute-value: hide value of boolean attribute or not ( 'remove' / 'preserve' )

    default: 'remove'

  • self-close: should void tags close themselves with "/" ( 'close' / 'no-close' )

    default: 'no-close'

  • level: current level

    default: 0

Development

  • run test cases
npm run test

Package Sidebar

Install

npm i @mewjs/html-code-gen

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

27.7 kB

Total Files

17

Last publish

Collaborators

  • gdjinbo