File tree Expand file tree Collapse file tree 1 file changed +8
-36
lines changed Expand file tree Collapse file tree 1 file changed +8
-36
lines changed Original file line number Diff line number Diff line change 18
18
npm i -D posthtml-render
19
19
```
20
20
21
- > ℹ️ This module is also available for [ bower] ( http://bower.io ) and as an AMD, CommonJS and IIFE (global) module, uncompressed and compressed
22
-
23
21
<h2 align =" center " >Usage</h2 >
24
22
25
23
### ` NodeJS `
26
24
27
25
``` js
28
- const render = require ( ' posthtml-render' )
26
+ import { render } from ' ' posthtml-render;
29
27
30
- const tree = []
28
+ const tree = [];
31
29
32
- const node = {}
30
+ const node = {};
33
31
34
- node .tag = ' ul'
35
- node .attrs = { class: ' list' }
32
+ node .tag = ' ul' ;
33
+ node .attrs = { class: ' list' };
36
34
node .content = [
37
35
' one' ,
38
36
' two' ,
39
37
' three'
40
- ].map ((content ) => ({ tag: ' li' , content }))
38
+ ].map ((content ) => ({ tag: ' li' , content }));
41
39
42
- tree .push (node)
40
+ tree .push (node);
43
41
44
- const html = render (tree, options)
42
+ const html = render (tree, options);
45
43
46
44
```
47
45
@@ -53,32 +51,6 @@ const html = render(tree, options)
53
51
</ul >
54
52
```
55
53
56
- ### ` 🌐 Browser `
57
-
58
- ``` html
59
- <!DOCTYPE html>
60
- <html >
61
- <head >
62
- <title >Title</title >
63
- <script src =" ./node_modules/posthtml-render/lib/browser.min.js" ></script >
64
- <script >
65
- const tree = {
66
- tag: ' h1' ,
67
- attrs: {
68
- style: ' color: red;'
69
- },
70
- content: [ ' Title' ]
71
- }
72
-
73
- window .onload = function () {
74
- document .body .innerHTML = render (tree)
75
- }
76
- </script >
77
- </head >
78
- <body ></body >
79
- </html >
80
- ```
81
-
82
54
<h2 align =" center " >Options</h2 >
83
55
84
56
| Name| Type| Default| Description|
You can’t perform that action at this time.
0 commit comments