-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help me] Add Chapel highlighting support #2800
Comments
PS — Here is the branch I've been working on, for reference: https://github.com/bradcray/highlight.js/tree/chapel-mode |
As a 3rd party grammar it will live inside its own repository. You can host it or we can host it here, that's entirely up to you. Take a look at some of the 3rd party repos here for structure. Just one: https://github.com/highlightjs/highlightjs-raku. But you can use pretty much you can use the same structure you're likely already familiar with from the main highlight.js repo, ie Then if you want to then use highlight.js to build (and test) your package (and create it's cd highlightjs/extra
git clone your_3rd_party_language_repo
cd ..
node ./tools/build.js -t node # will build a npm package that includes your grammar
# run tests, etc
No idea, that's very strange. You could try to add some console logging or debugging to see why |
That might be tough, but good luck. Most people don't realize that these major upstream consumers use a VERY particular build of Highlight.js and choose their language subset very carefully (due to size/performance constrains). Just creating a new grammar module (third party or even first party) is no guarantee that any of these major websites will support your language. |
Thanks for the quick responses, @joshgoebel. w.r.t. the Out of curiosity, is there a process for petitioning to incorporate a language into the main repository rather than treating it as a 3rd-party grammar? Or maybe put another way: What determines whether highlight.js treats a language as a 3rd-party grammar vs. one in the main repo? Thanks again! |
While I agree that the path to getting Chapel highlighting enabled by SO for our tag may be an uphill climb, it appears that Discourse sites do have a hook that permits third-party languages to be enabled, so that's encouraging. Linking here for others who may stumble across this: https://meta.discourse.org/t/hack-to-install-a-new-language-for-highlight-js-on-a-hosted-discourse/55818/7 |
Oh wow, that's completely amazing. :-) Yes, if they allow injecting HTML/JS/CSS (via theme) then yes any "admin" (or whatever) of a Discord site could do this. That's news to both of us. I did not know that. :)
Short answer: The core team does not have time to maintain any more languages (review, bugs, support, long-term maintenance, etc.) - we can barely keep up with the ones we have. So therefore, no more first party languages. It's very easy for anyone who desires to use a 3rd party language. Long answer: #2149 |
Closing as we have the new PR to track this. |
Hi highlight.js developers and experts —
I'm interested in adding support for the Chapel language (https://chapel-lang.org) to highlight.js, and managed to throw together a very simple (but better than nothing) highlighter on my laptop today that is building and rendering properly for me, and I'm looking for helps at next steps. As a disclaimer, this is my first experience with node.js.
At this point I have two main questions:
At the high level: Reading the various contributing docs, I've ended up confused about whether the best practice is to:
chapel.js
to the mainhighlight.js/highlight.js
repo...src/languages/
(which is where most languages seem to be?)extra/...
(which is where3RD_PARTY_QUICK_START.md
suggests it should be)highlight.js
(which3RD_PARTY_QUICK_START.md
alludes to?)where my main goals is to have our Discourse site support Chapel highlighting and a secondary goal would be to have StackOverflow use it as well.
At the low level: Though I've been able to do do a Chapel-specific build using
node tools/build.js -n chapel
and got reasonable output usingdeveloper.html
, I've been unable to get a scripted all-languages build and test working using the instructions in the various docs, even from a clean copy of the repo that does not contain my changes. E.g., from a copy of the tree in sync with the master/main branch (SHA = 1982c8c), I get:and a similar result when I use
npm run build_and_test
Thanks for any advice with either of these issues.
The text was updated successfully, but these errors were encountered: