malte-wessel / react-textfit

React component to fit headlines and paragraphs into elements
http://malte-wessel.github.io/react-textfit/
MIT License
470 stars 143 forks source link

Configuring the output HTML element types? #20

Closed andyford closed 7 years ago

andyford commented 7 years ago

Is there a way to configure or somehow manipulate the HTML wrapper elements that the plugin generates?

The generated markup is div > span

So if you use:

<Textfit mode="single">
    <h2>Fat headline!</h2>
</Textfit>

...then the output is div > span > h2 this is invalid markup because block elements (like H2) cannot be nested inside of inline elements (like span)

And if you use:

<h2>
    <Textfit mode="single">
        Fat headline!
    </Textfit>
</h2>

...then the output is h2 > div > span this is invalid markup because block elements (like div) cannot be nested inside of heading elements (like H2)

Is is possible to either:

thanks!