FormidableLabs / prism-react-renderer

🖌️ Renders highlighted Prism output to React (+ theming & vendored Prism)
MIT License
1.88k stars 152 forks source link

Set line-height? #37

Closed karlhorky closed 9 months ago

karlhorky commented 5 years ago

Hey there! Would this project be open to instituting a fixed line-height (maybe configurable?) to make rendering across different fonts / browsers more consistent? Not sure how out of date the information is, but I've been reading some articles that line-height: normal is not the same across browsers. I would also find this useful to be able to position elements relative to each line more consistently.

Prism has made the decision to use line-height: 1.5 for all themes (Ref: PrismJS/prism#279). 1.5 seems a bit excessive, especially with the more minimal Menlo font-family, which is the default used by the default code-surfer configuration. Prism uses Consolas as the default when visiting the website on macOS, which both has a higher default line-height (with line-height: normal) and looks better like this.

Below is a comparison of the following:

Kapture 2019-05-20 at 12 20 37

For a further reference, HTML Boilerplate currently uses 1.4.

I am not actually all into this topic, so I may miss out on downsides or complexities involved in this.

cc @pomber

karlhorky commented 9 months ago

@carbonrobot is this really completed? Where can we see the documentation of this feature?

carbonrobot commented 9 months ago

This library is just a React extension for Prismjs to make the setup a little easier. At this time, we don't want to support anything custom over what prismjs does by default unless neccessary.

karlhorky commented 9 months ago

Ok, thanks for the reply. Maybe technically it should be closed as "Not planned" then.