Skip to content

Commit 38b2b04

Browse files
committed
docs: add quoteStyle option
1 parent 18d31c0 commit 38b2b04

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

readme.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const html = render(tree, options)
8989
|**[`closingSingleTag`](#closingSingleTag)**|`{String}`|[`>`](#default)|Specify the single tag closing format|
9090
|**[`quoteAllAttributes`](#quoteAllAttributes)**|`{Boolean}`|[`true`](#default)|Put double quotes around all tags, even when not necessary.|
9191
|**[`replaceQuote`](#replaceQuote)**|`{Boolean}`|[`true`](#default)|Replaces quotes in attribute values with `&quote;`.|
92+
|**[`quoteStyle`](#quoteStyle)**|`{0|1|2}`|[`2`](#default)|Specify the style of quote arround the attribute values|
9293

9394
### `singleTags`
9495

@@ -200,6 +201,33 @@ Replaces quotes in attribute values with `&quote;`.
200201
<img src="<?php echo $foo["bar"] ?>">
201202
```
202203

204+
### `quoteStyle`
205+
206+
##### `2 (Default)`
207+
208+
Attribute values are wrapped in double quotes:
209+
210+
```html
211+
<img src="https://example.com/example.png" onload="testFunc("test")">
212+
```
213+
214+
##### `1`
215+
216+
Attribute values are wrapped in single quote:
217+
218+
```html
219+
<img src='https://example.com/example.png' onload='testFunc("test")'>
220+
```
221+
222+
##### `0`
223+
224+
Quote style is based on attribute values (an alternative for `replaceQuote` option):
225+
226+
```html
227+
<img src="https://example.com/example.png" onload='testFunc("test")'>
228+
```
229+
230+
203231
[npm]: https://img.shields.io/npm/v/posthtml-render.svg
204232
[npm-url]: https://npmjs.com/package/posthtml-render
205233

0 commit comments

Comments
 (0)