# PostHTML
PostHTML is a tool for transforming HTML/XML with JS plugins. PostHTML itself is very small. It includes only a HTML parser, a HTML node tree API and a node tree stringifier.
All HTML transformations are made by plugins. And these plugins are just small plain JS functions, which receive a HTML node tree, transform it, and return a modified tree.
For more detailed information about PostHTML in general take a look at the [docs](https://github.com/posthtml/posthtml/tree/master/docs).
### Dependencies
| Name | Description |
|:----:|:-----------:|
|[posthtml-parser](https://github.com/posthtml/posthtml-parser)| Parser HTML/XML to PostHTMLTree |
|[posthtml-render](https://github.com/posthtml/posthtml-render)| Render PostHTMLTree to HTML/XML |
## Create to your project
```bash
npm init posthtml
```
## Install
```bash
npm i -D posthtml
```
## Usage
### API
**Sync**
```js
import posthtml from 'posthtml'
const html = `
Super TitleAwesome Text
`
const result = posthtml()
.use(require('posthtml-custom-elements')())
.process(html, { sync: true })
.html
console.log(result)
```
```html
Super Title
Awesome Text
```
> :warning: Async Plugins can't be used in sync mode and will throw an Error. It's recommended to use PostHTML asynchronously whenever possible.
**Async**
```js
import posthtml from 'posthtml'
const html = `
## Contributors
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/posthtml#backer)]
[chat]: https://badges.gitter.im/posthtml/PostHTML.svg
[chat-url]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"