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 1818npm i -D posthtml-render
1919```
2020
21- > ℹ️ This module is also available for [ bower] ( http://bower.io ) and as an AMD, CommonJS and IIFE (global) module, uncompressed and compressed
22-
2321<h2 align =" center " >Usage</h2 >
2422
2523### ` NodeJS `
2624
2725``` js
28- const render = require ( ' posthtml-render' )
26+ import { render } from ' ' posthtml-render;
2927
30- const tree = []
28+ const tree = [];
3129
32- const node = {}
30+ const node = {};
3331
34- node .tag = ' ul'
35- node .attrs = { class: ' list' }
32+ node .tag = ' ul' ;
33+ node .attrs = { class: ' list' };
3634node .content = [
3735 ' one' ,
3836 ' two' ,
3937 ' three'
40- ].map ((content ) => ({ tag: ' li' , content }))
38+ ].map ((content ) => ({ tag: ' li' , content }));
4139
42- tree .push (node)
40+ tree .push (node);
4341
44- const html = render (tree, options)
42+ const html = render (tree, options);
4543
4644```
4745
@@ -53,32 +51,6 @@ const html = render(tree, options)
5351</ul >
5452```
5553
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-
8254<h2 align =" center " >Options</h2 >
8355
8456| Name| Type| Default| Description|
You can’t perform that action at this time.
0 commit comments