1.0.31 • Published 2 years ago

htmler-render v1.0.31

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

htmler-render

Html template render.

Install

npm i htmler-render --save

Usage

Options

NameTypeDefaultDescription
singleTags{Array<String\|RegExp>}[]Specify custom single tags (self closing)
closingSingleTag{String}>Specify the single tag closing format
quoteAllAttributes{Boolean}truePut double quotes around all tags, even when not necessary.
replaceQuote{Boolean}trueReplaces quotes in attribute values with &quote;.
quoteStyle{0 or 1 or 2}2Specify the style of quote arround the attribute values

singleTags

Specify custom single tags (self closing)

closingSingleTag

Specify the single tag closing format

'tag'
const html = render(tree, { closingSingleTag: 'tag' })
<custom></custom>
'slash'
const html = render(tree, { closingSingleTag: 'slash' })
<custom />
'default' (Default)
const html = render(tree)
<img>
'closeAs'
const tree = [ {
  tag: 'custom',
  closeAs: 'default' // Available types: `tag` | `slash` | `default`
} ]
const html = render(tree, { closingSingleTag: 'closeAs' })
<custom>

quoteAllAttributes

Specify if all attributes should be quoted.

true (Default)
<i src="index.js"></i>
false
<i src=index.js></i>

replaceQuote

Replaces quotes in attribute values with &quote;.

true (Default)
<img src="<?php echo $foo[&quote;bar&quote;] ?>">
false
<img src="<?php echo $foo["bar"] ?>">

quoteStyle

2 (Default)

Attribute values are wrapped in double quotes:

<img src="https://example.com/example.png" onload="testFunc("test")">
1

Attribute values are wrapped in single quote:

<img src='https://example.com/example.png' onload='testFunc("test")'>
0

Quote style is based on attribute values (an alternative for replaceQuote option):

<img src="https://example.com/example.png" onload='testFunc("test")'>
1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3-alpha.7

3 years ago

1.0.3-alpha.8

3 years ago

1.0.3-alpha.5

3 years ago

1.0.3-alpha.6

3 years ago

1.0.3-alpha.9

3 years ago

1.0.3-alpha.10

3 years ago

1.0.3-alpha.4

3 years ago

1.0.3-alpha.3

3 years ago

1.0.3-alpha.2

3 years ago

1.0.3-alpha.1

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-alpha.2

3 years ago

1.0.0-alpha.1

3 years ago