prism-react-renderer
prism-react-renderer copied to clipboard
1.1.0 -> 1.1.1 breaks Python highlighting in Docusaurus
Hi,
Docusaurus (v2) uses this project for syntax highlighting.
https://v2.docusaurus.io/docs/theme-classic/#codeblock
Let's take this code:
@dataclass
class MySQLConfig:
host: str = "localhost"
port: int = 3306
@dataclass
class Config:
db: MySQLConfig = MySQLConfig()
verbose: bool = True
cfg_store = ConfigStore.instance()
cfg_store.store(name="config", node=MyConfig)
@hydra.main(config_name="config")
def my_app(cfg: MyConfig) -> None:
# Python knows that the type of cfg.db is MySQLConfig without any additional hints
print(f"Host: {cfg.db.host}, port: {cfg.db.port}")
if __name__ == "__main__":
my_app()
When using:
"resolutions": {
"prism-react-renderer": "1.1.0"
},
Python highlighting works fine for this code:

But when using newest version, highlighting is missing for things like decorators (or applied partially):
"resolutions": {
"prism-react-renderer": "1.1.1"
},

@kitten as you proposed your help already here: https://github.com/facebook/docusaurus/pull/2666#issuecomment-619602671 wonder if you can help me figure out what's happening.
The code does not seems to change much from 1.1.0 to 1.1.1 so I don't understand.
Anything I don't see in the commits?
Do you think this might affect other languages as Python, and that we should temporarily lock users to 1.1.0?
@slorber This may be happening because of a change in the Prism version that's bundled... have you tried a custom version of prismjs instead? if a newer one works I can release a quick patch with an upgrade
How can I use or upgrade prism? Should I just hack in the node_modules/prism-react-renderer/prism folder?
You can pass in a different instance of Prism as a prop: https://github.com/FormidableLabs/prism-react-renderer#advanced-props
Thanks.
How can I know which version is currently vendored in this lib?
The package says "prismjs": "^1.20.0", and it does seem to have changed, and it's the latest version of Prism anyway. Is this the version vendored here?
Here's a PR that fixes a Docusaurus site: https://github.com/facebookresearch/hydra/pull/730/files#diff-133739a86bc2f5157391e0018e5f9d01R7409
The yarn lock versions of prism is still the same before/after
Hm, that's odd, it should indeed still be 1.20.0. I may have to look into this a little further
Closing, we are using a much newer version of prismjs