RepositoryJavaScript
posthtml

posthtml/posthtml

PostHTML is a tool to transform HTML/XML with JS plugins

3.0kstars
113forks
3issues
0views

🔧 HTML/XML Transformer with Plain JS Plugins

A dead-simple pipeline: parse HTML into a tree, run small JS plugins on it, then serialize back to markup.

PostHTML is a minimal toolkit for transforming HTML or XML using lightweight JavaScript plugins. Its core contains nothing but an HTML parser, a node-tree API, and a stringifier — everything else lives in community plugins. Each plugin is just a plain function that receives a tree, transforms it, and returns the result.

✨ Highlights

  • Tiny core: Only an HTML parser, a node-tree API, and a stringifier — no opinions, no magic.
  • Plugin model: Plugins are plain JS functions operating on the tree; compose them freely.
  • Sync & async: Process synchronously when possible, or asynchronously for plugins that support it.
  • Directives: Strip or rewrite custom syntax (e.g., <?php ?>) before plugins touch the tree.
  • Rich ecosystem: CLI, Gulp, Grunt, Webpack (html-loader + posthtml-loader), Rollup — pick what fits your build tool.
  • Parser flexibility: Swap posthtml-parser for any alternative like pug or sugarml.
  • Plugin ecosystem: Community plugins cover custom elements, SVG tag generation, attribute extension, template includes, BEM, and more.
  • Zero-config setup: npm init posthtml or npm i -D posthtml installs in seconds.

💡 Why it matters

PostHTML exists because most HTML-processing tools bundle their own parser, stringifier, and transformation logic into one monolithic package. PostHTML separates these concerns: the core stays tiny and replaceable, while the real power comes from plugins. This makes it trivial to swap parsers, add custom transformations, or integrate into any existing build pipeline without learning a new DSL. It's especially useful when you need to manipulate HTML structure programmatically (attribute rewriting, tag substitution, content injection) rather than just minify or clean up output.


#HTML #OpenSource #JavaScript #BuildTools #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
fb55/htmlparser2

The fast & forgiving HTML and XML parser

4.8k
Dec 1, 2026
RepositoryPHP
Imangazaliev/DiDOM

Simple and fast HTML and XML parser

2.2k
Jan 28, 2026
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryJavaScript
twbs/bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

175.1k
Dec 1, 2026
RepositoryPython
huggingface/transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

169.5k
Dec 1, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryTypeScript
firecrawl/firecrawl

Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.

215.1k
Dec 2, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
RepositoryTypeScript
cheeriojs/cheerio

The fast, flexible, and elegant library for parsing and manipulating HTML and XML.

30.6k
Dec 2, 2026