Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

stevenvachon/handlebars-html-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handlebars-html-parser

Parse Handlebars and HTML.

Parse this:

<{{tag}}>value</{{tag}}>

into this:

[ { type:"htmlTagStart", closing:false }, { type:"htmlTagNameStart" }, { type:"hbsVariable", id:"tag" }, { type:"htmlTagNameEnd" }, { type:"text", text:"value" }, { type:"htmlTagStart", closing:true }, { type:"htmlTagNameStart" }, { type:"hbsVariable", id:"tag" }, { type:"htmlTagNameEnd" }, { type:"htmlTagEnd" } ]

…for use in compiling to something like a virtual DOM, such that of handlebars-react.

For more information on the strengths, weaknesses and implementation details of this library, check out the wiki.

FAQ

  1. How is this different from HTMLBars?
    HTMLBars builds a DOM whereas this library allows you to build a DOM and even a virtual DOM.

  2. Why not use parse5?
    As of v1.2.0, it is not forgiving enough, in that it will parse <{{tag}}>asdf</{{tag}}> as text instead of HTML.

Roadmap Features

  • add support for sub-expressions, whitespace control, etc
  • options.collapseWhitespace (except on <pre> tags) to lighten file size and improve runtime performance
  • options.ignoreComments to omit html comments from compiling
  • options.mustacheOnly that disables helpers

Changelog

  • 0.0.1–0.0.3 pre-releases

About

Parse Handlebars and HTML.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published