Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Fix Firefox extra newline bug without requiring CSS changes from user #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fracture91
Copy link

@fracture91 fracture91 commented Mar 2, 2021

See juanbzpy#4

I've tested this in my own repo that uses this plugin on Firefox, Chrome, and an iOS 14.4 simulator. Seems to work fine in all cases.

I'll also open a PR against the upstream repo, but this one seems more likely to be merged ;)

The original code introduced extra empty text nodes that were not present
in the original unforked mdx-prism output.  This apparently makes Firefox
interpret the preceding newline as one it should actually render like
any other newline in the `pre` tag.

The bug is only visible at the AST level, not the toString'd output, hence
the new weird test.  I believe MDX turns this AST into JSX, which preserves
the empty text node.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant