danomatic / react-pdf-html

Render HTML in react-pdf
MIT License
167 stars 40 forks source link

Bug: First fontWeight applied to whole paragraph instead of specific <b>/<span> section #91

Closed JorgeAtPaladin closed 4 months ago

JorgeAtPaladin commented 5 months ago

I'm using react-pdf with nodejs (had to apply the fix of #89 to get css styles to properly work).

For us it all works fine as long as the whole string is marked as bold but as soon as we render a portion of the string as bold eg. Hello, <b>world</b> it all becomes non bold? Same with inline spans etc.

Rendering: <b>x</b>x results in xx x<b>x</b> results in xx

The first fontweight is always applied to the whole paragraph

We've also seen that the same issue goes for inline fontFamily changes. However, tags like <u>, <s>, spans with styles... all work fine.

Reproduction Try rendering the above strings at the latest versions, not sure if its nodejs specific.

JorgeAtPaladin commented 4 months ago

Figured out this relates to https://github.com/diegomura/react-pdf/issues/2725

JorgeAtPaladin commented 4 months ago

Fixed according to the above recommended fix to package.json:


  "resolutions": {
    "@react-pdf/layout": "3.11.5"
  },