Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/we-lib/obj-html

Parse js obj model to html
https://github.com/we-lib/obj-html

Last synced: 23 days ago
JSON representation

Parse js obj model to html

Awesome Lists containing this project

README

        

# obj-html

Parse js obj model to html

## Usage

Expected:

```html




My Page






Bla bla bla..


```

Parsing:

```js
var parseHtml = require('obj-html')
var html = parseHtml(htmlObj)
console.log(html)
```

Source:

```js
[
{
'tag': '!doctype',
'attrs': {
'html': true
}
},
{
'tag': 'html',
'children': [
{
'tag': 'head',
'children': [
{
'tag': 'meta',
'attrs': {
'charset': 'utf-8'
}
},
{
'tag': 'title',
'children': [
'My Page'
]
},
{
'tag': 'link',
'attrs': [
'rel': 'stylesheet',
'href': 'style.css'
]
}
]
},
{
'tag': 'body',
'children': [
{
'tag': 'div',
'attrs': {
'id': 'box'
}
},
{
'tag': 'p',
'children': [
'Bla bla bla..',
{
'tag': 'i',
'attrs': {
'class': 'icon foo'
}
}
]
}
]
}
]
}
]
```