-
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
Add Red language highlighting #988
Conversation
Ok... to resolve detection conflict with Apache was quite easy, but what a hack, how I can resolve conflict with something like Inform 7 !? Please help! |
Fine.. Red language does not allow comma after alpha chars, so this conflict is fixed too.. but how to solve conflict between vhdl and Inform7 now? Crazy. |
@@ -37,6 +37,7 @@ function(hljs) { | |||
}, | |||
{ | |||
className: 'section', | |||
relevance: 8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually try to avoid very precise relevance boosters. If this required, just use 10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used 10 in the commit above, but than I had conflict with Gems.
…atica and removing common category.
Sorry for so many commits, I was not able to install the test suite locally because of some dependency reasons. |
…t to eat spaces in front of it (shame there is not a look-back chance)
Resolving detection conflicts is a sort of an art in itself :-) It's best done by creating more specific contexts, rather than fiddling with relevance values. You can leave it as is for now, I'll try to have a look some time next week. The dependency problem may be due to the fact that we use node 4.x since recently. |
@isagalaev Sorry that I ask, it is my first time I use node.js, but trying to run the test locally and not to pollute it here with every little change, I have this error:
I have Node v4.2.2 on MacOS. Any idea what is wrong? Also I had these warning on
|
…nstead of Asciidoc in small code samples.
@isagalaev forget my building question above.. I found that I must do build for node, not just the default one for browser.. so now I can save some invalid commits as a part of language detection part:) |
…ection without conflicts in tests and adding description
…not ordinary words (some'thing) handling. Included category: functional csp: increased relevance for single quota strings, so it takes precedence over Red language in autodetection
Is there any update on this? Would love to support Red in Gitter. https://gitter.im/gitterHQ/gitter?at=58f8f9cc8e4b63533de9d32b |
Tried to merge it today but there's quite a lot of little thing here and there that needed to be fixed for this definition to play well with each other. I understand it's been a while, so I have to ask if anyone (original author or not) is still interested in getting this done, I'd make a full review on it. |
Cool! The best way to do it then is for someone to fork this branch and create a new PR with it so we could actually make changes. I'm not familiar with Red at all to do anything on my own :-) |
Hi @isagalaev thank you for your interest.. I will make a new clean PR and will let you know here. |
@Oldes thanks! I looked through the history of this ticket and only now see that we actually tried to review it before :-) If you're going to make a fresh one, pleasen ignore language detection problems on the first go and don't tune relevance. We'll deal with it after the code is in the correct shape. |
Yeah, this is annoying. But I don't hit it often enough to figure out how to best fix it. We could have separate build directories for each or always use the subfolders (like when you do a build |
First of all, truly sorry for the long delay in processing this PR. Thank you so much for desiring to contribute and writing a language grammar. Unfortunately, we currently are no longer accepting new languages into the core repository. The existing maintainers simply don't have time to maintain new languages (fixing bugs, dealing with issues, etc). We'd still love to host your language as a 3rd party module though - if you're willing to help maintain it. It's easy to turn your language into a module that anyone who likes can easily integrate with Highlight.js using a single line of code: <script src="/path/to/highlight.min.js"></script>
<!-- they'd simply add your language modules -->
<script src="/path/to/highlightjs-red-lang.js"></script>
<script>hljs.initHighlightingOnLoad();</script> It's also possible for users to rebuild the If you'd like to become the maintainer for this language then we're happy to create a new repository in the There isn't much in the way of how to docs on this yet, but there are sample repositories and it's honestly pretty easy. We're still fleshing out an official "spec" for 3rd party modules, but even after that's done it should require minimal changes from the examples we have already. IE, if you wanted to get started now there isn't any big reason to wait. My own https://github.com/highlightjs/highlightjs-robots-txt If you have any questions feel free to ask. |
Closing for inactivity; (also finally cleaning all these old PRs out for the new year). As mentioned above if you're interested in becoming the maintainer of a 3rd party module, please respond [whenever you find time] and we'd be happy to help you get started. |
@joshgoebel Hi Josh... so I'm back again and ready to create a 3rd party module... what I should do? Should I host it under my account? Or you will set up a repo for me? I would really want to have colorizer for Red language (and Rebol) available under Gitter and this is the only path. |
Does Gitter let you control the JS/HTML and inject your own code? https://github.com/highlightjs/highlight.js/blob/master/extra/3RD_PARTY_QUICK_START.md
Your choice. We can make a repo here or you can have it under your own account. |
No... I think that no one sane enough would allow JS injection... but Gitter is using Highlight.js, so the only way how to get our code colorized there is adding support for the language into oficial repository somehow. I was reading the
If it's not possible to use 3rd_party module by 4th_party user (Gitter), than it does not make much sense... because to build version for my personal purposes, I can easily put the files under normal structure, how I was doing it 5 years ago :-/ |
Many hosted services do. If they allowed you to add your own HTML/CSS/theme then you can typically add JS just be adding script tags, etc... this is a common way to customize many sites. I just learned the other day you can add 3rd party languages to Discourse via this type of functionality.
This indicates is a pretty large misunderstanding. The way to get your code colorized on Gitter is to get Gitter to care about your language, period. If they don't, you won't. If they do, you might. Getting your language into our core library alone means nothing. Gitter seems to use only ~70 languages or so... we support 190... Very often services that use our library (Gitter, Discord, StackOverflow, etc) purposely only use a fraction of the languages (for various reasons). Just getting your favorite language added upstream does not magically make it work anywhere that uses Highlight.js. Highlight.js (at it's core) is just a highlighting engine - that comes bundled with 190 languages you can potentially use. It's possible to use it and use only a single grammar - just because someone is using Highlight.js doesn't mean they highlight every single language that we provide with the core library.
We'd add it to the official list of supported languages - so anyone looking would know it exists. They'd have to decide to install support for it - just like they do with their existing 70 languages out of a much larger # of possible languages they could support.
It can be made to work different ways.
To build along side the core library you would checkout your repository into the
Anyone who chooses can use 3rd party modules. We make that easy to do, but services have to decide which languages to support. This is true whether the language is 1st or 3rd party. Typically getting large services to add language support for languages that aren't super popular is an uphill battle though.
Yes, but if you care about anyone in the broader community (of millions of users) being able to easily use your grammar then you'd really want to publish it as a 3rd party module - so that they could drop it into their projects with only a single line of code. |
I'm not expecting the support to appear somewhere automatically.. I was asking on Gitter chat about it: https://gitter.im/gitter/gitter?at=5fb16c92f2fd4f60fc7637de |
I just simply does not understand why you decided to go this strange 3rd party way... why you just don't allow to build specific set of languages on demand and have these languages in the main repo... I simply don't understand how is this more user friendly? |
Context: No one ever said it’s more user-friendly. It takes a lot of time and effort to support and maintain or add languages to the core library. It’s time that the current maintainers simply don’t have. We are barely keeping up with existing and popular languages as it is. So we made it possible and easy for anyone who wants to create third-party grammar modules that anyone can use with about one line of code. |
If you’re serious about Gitter I’d suggest making a third-party grammar and then making a pull request against the Gitter markdown stuff to use that grammar and see where that gets you. |
I will, but I still don't understand, what are we second-class language users supposed to do to have it registered in h.js :-/ |
Ok... that makes sense.. it should be mentioned here: https://github.com/highlightjs/highlight.js/blob/master/extra/3RD_PARTY_QUICK_START.md So I will make a self hosted repo and than submit PR to add a link into the list. |
PR welcome. |
@joshgoebel here it is: #2872 --> https://github.com/Oldes/highlightjs-redbol |
Related: www.red-lang.org