prql icon indicating copy to clipboard operation
prql copied to clipboard

Prism syntax highliting

Open eitsupi opened this issue 10 months ago • 6 comments

https://prismjs.com/#supported-languages

Prism is used by Docusaurus, a popular static site generator.

Here is an example of third-party syntax that should be able to support PRQL in the same way. https://github.com/SassDoc/prism-scss-sassdoc

eitsupi avatar Oct 11 '23 14:10 eitsupi

Wow, @vanillajonathan already created a PR for this! (PrismJS/prism#3736) Thanks @vanillajonathan!

eitsupi avatar Oct 12 '23 03:10 eitsupi

TODO: Enable prql syntax highlighting on ClickHouse documents (https://github.com/ClickHouse/clickhouse-docs/blob/44fb2eefa08e8d6037c91958292ccca40003f294/docusaurus.config.js#L214) once this is available from Docusaurus

eitsupi avatar Oct 12 '23 11:10 eitsupi

Prism is working on Prism v2 so they're no longer accepting any contributions to v1. My PR is against the v2 branch, I hope it will get merged. There is a roadmap but no information about when v2 will be released.

https://github.com/PrismJS/prism/discussions/3531 (Roadmap for Prism v2) https://github.com/PrismJS/prism/issues?q=is%3Aissue+milestone%3A2.0 (Milestone for v2)

vanillajonathan avatar Oct 12 '23 12:10 vanillajonathan

I see, thank you for the explanation (I don't remember it at all, but there was evidence that I responded to that discussion).

Maybe it's possible to keep it here or another repo like https://github.com/SassDoc/prism-scss-sassdoc if it's not merged?

eitsupi avatar Oct 12 '23 12:10 eitsupi

Maybe it's possible to keep it here or another repo like https://github.com/SassDoc/prism-scss-sassdoc if it's not merged?

Yes, I suppose so, but my intention and hope is for the PR to be merged upstream so that it will be readily and easily available downstreams without additional setup, configuration or packages.

Note that clickhouse-docs uses Prism v1 and my PR is for Prism v2. We could create a syntax highlight definition for v1, but without it being available upstream it would be more burden on downstream users of Prism to use our syntax highlighting.

vanillajonathan avatar Oct 12 '23 13:10 vanillajonathan

Thanks, it seems that Docusaurus depends on prism vendored version on prism-react-renderer. https://github.com/FormidableLabs/prism-react-renderer/blob/9c041dfd8580b8b71f55c2a57e61f4c63356d4f4/package.json#L44 https://github.com/FormidableLabs/prism-react-renderer?tab=readme-ov-file#prism

Perhaps it will take a while to reach Docusaurus here after the PRs are merged.

eitsupi avatar Oct 12 '23 13:10 eitsupi