Htmr Versions Save

Simple and lightweight (< 2kB) HTML string to React element conversion library


1 year ago
  • Fix peer dependencies for react 18
  • Fix react-native imports
  • Fix item* attributes


2 years ago

Fix non-boolean attribute treatment #138

Previously these HTML trigger react warning because it satisfies boolean attribute value requirement (value equals to attribute name, or empty string).

<img alt="alt" />
<div class=""></div>

It's rendered into

// jsx equivalent
<img alt={true} />
<div className={true}></div>

Now htmr will validate whether the attribute is boolean attribute before using boolean value. If not, the attribute will simply be forwarded as is

Example above now rendered as

// jsx equivalent
<img alt="alt" />
<div className=""></div>


2 years ago

First stable release! 🚀

  • React 17 support
  • Reduced client bundle by relying more on DOM
  • major update for server dependencies (html-entities
  • CSS custom properties support in style attribute


2 years ago
  • Fixed type definition where ref conflict


2 years ago
  • Empty child for dangerouslySetChildren is now allowed

Previously, these don't work

htmr('<script></script>', { dangerouslySetChildren: ['script'] });


2 years ago
  • update htmlparser2 to v6


3 years ago
  • exported HtmrOptions as top-level named export
import { HtmrOptions } from 'htmr'
  • Better props type annotation for transform
const transform: HtmrOptions = {
  a: props => {
    // props is now automatically inferred
    if (props.href.startsWith('http') {
  • SVG tags support
const transform: HtmrOptions = {
  svg: props => {
    return <>{props.viewBox}</>
  • Fixed type definition for default transform return value
  • Fixed viewBox warning when rendering svg element


3 years ago

fix server-side parser for script tag (#115)


3 years ago

Fixed XSS issue in DOM based parser


4 years ago

Fixed transform doesn't get applied when using dangerouslySetChildren