Skip to content

Commit

Permalink
docs: update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Jul 27, 2021
1 parent f45d8ed commit d80591f
Showing 1 changed file with 8 additions and 36 deletions.
44 changes: 8 additions & 36 deletions readme.md
Expand Up @@ -18,30 +18,28 @@
npm i -D posthtml-render
```

> ℹ️ This module is also available for [bower](http://bower.io) and as an AMD, CommonJS and IIFE (global) module, uncompressed and compressed
<h2 align="center">Usage</h2>

### `NodeJS`

```js
const render = require('posthtml-render')
import { render } from ''posthtml-render;

const tree = []
const tree = [];

const node = {}
const node = {};

node.tag = 'ul'
node.attrs = { class: 'list' }
node.tag = 'ul';
node.attrs = { class: 'list' };
node.content = [
'one',
'two',
'three'
].map((content) => ({ tag: 'li', content }))
].map((content) => ({ tag: 'li', content }));

tree.push(node)
tree.push(node);

const html = render(tree, options)
const html = render(tree, options);

```

Expand All @@ -53,32 +51,6 @@ const html = render(tree, options)
</ul>
```

### `🌐 Browser`

```html
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<script src="./node_modules/posthtml-render/lib/browser.min.js"></script>
<script >
const tree = {
tag: 'h1',
attrs: {
style: 'color: red;'
},
content: [ 'Title' ]
}
window.onload = function () {
document.body.innerHTML = render(tree)
}
</script>
</head>
<body></body>
</html>
```

<h2 align="center">Options</h2>

|Name|Type|Default|Description|
Expand Down

0 comments on commit d80591f

Please sign in to comment.