npm install @hexlet/html-builder
import parse from '@hexlet/html-builder';
const data = ['html', [
['head', [
['title', 'hello, hexlet!'],
]],
['body', [
['div', { class: 'separator' }],
['h1', { class: 'header' }, 'html builder example'],
['div', [
['img', { class: 'image', href: '#' }],
['span', 'span text2'],
]],
]],
]];
const ast = parse(data);
ast.toString();
// '<html>
// <head><title>hello, hexlet!</title></head>
// <body><div class="separator"></div>
// <h1 class="header">html builder example</h1>
// <div><img class="image" href="#"><span>span text2</span>
// </div></body></html>'
For more information, see the Full Documentation
This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.
See most active contributors on hexlet-friends.