PRQL / prql

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
https://prql-lang.org
Apache License 2.0
9.67k stars 208 forks source link

Move out highlight.js to a separate repo #3563

Open vanillajonathan opened 10 months ago

vanillajonathan commented 10 months ago

What's up?

The highlight.js project does not accept new languages into the core library, instead they have the notion of supported third-party languages.

For this we need a repository named highlightjs-prql, either under the PRQL organization i.e. /PRQL/highlightjs/, or a repository can be requested under the highlightjs organization on GitHub, i.e. /highlightjs/highlightjs-prql/. Requesting a repository under their organization is optional.

Then we need tests for it and to publish the package on npm. Then file a pull request to have it listed under their supported languages page.

All this is documented at: https://highlightjs.readthedocs.io/en/latest/language-contribution.html

max-sixty commented 10 months ago

This would be great to do, very much agree.

Possibly relatedly — I spent a while trying to see whether we could only have a single copy of the highlight.js grammar. I couldn't work out how to do it (though my JS is terrible). So either we can copy & paste it to the repo as a third place or, if we can work out a way of importing the grammar with a separate repo, then that would be another improvement.

vanillajonathan commented 10 months ago

We could use the submodules in Git to reference that repository from this repository. I think we ought to publish the highlighter as a npm package then have the website load it via cdnjs.

The hljs.registerLanguage("prql", formatting); should maybe be within script tags on pages that need syntax highlighting, but it doesn't belong inside the language file.

max-sixty commented 10 months ago

I think we ought to publish the highlighter as a npm package then have the website load it via cdnjs.

Yes I think this probably makes sense. Definitely keener on this over submodules.

The hljs.registerLanguage("prql", formatting); should maybe be within script tags on pages that need syntax highlighting, but it doesn't belong inside the language file.

IIRC there were some issues about getting the book to put this in the right place. But even if we do it only on the playground, that's still a benefit. And we can probably engineer around any mdbook issues...