Skip to content
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

Creating own language highlighting #1182

Closed
dkern opened this issue Sep 4, 2017 · 10 comments
Closed

Creating own language highlighting #1182

dkern opened this issue Sep 4, 2017 · 10 comments

Comments

@dkern
Copy link
Contributor

dkern commented Sep 4, 2017

I've created a highlighting for arduino language. But I have problems with the operators, like =, &&, ! == and so on. I don't know how to do this correctly and I found no documentation for creating new languages. I hope I did it right so far.

I've created an working example recreating my problems.

Later on, is there a way to add this language to the repository, or is this not wished?

@Golmote
Copy link
Contributor

Golmote commented Sep 7, 2017

Hi! Could you be more specific about the issue you have with the operators?

You can find documentation on language creation on this page.

Regarding the addition of this to the official repo, I'm not sure "Arduino" can be considered as a language. If I understand correctly, this is just C++.

That being said, I think it's great that you're creating your own language extension to have it highlighted as you want it to be.

@dkern
Copy link
Contributor Author

dkern commented Sep 11, 2017

Hello @Golmote

Basically you're right, it's c++ (thats why I'm extending c++ in my example), but with other function, keyswords and constants. As you see in my example. Not a decent language, but used very often. If this not suit your needs, I'm fine with it. But other tools like highlight.js supporting it already.

But back to the problem: if you take a look into my example, you see in the result on the very top, that things like = are highlighted with a background color. I don't know why this happens and how I could change this.

@dkern
Copy link
Contributor Author

dkern commented Sep 11, 2017

I made you a shorter example, where you should see the problem easily.

@Golmote
Copy link
Contributor

Golmote commented Sep 11, 2017

That's because you're loading two themes at the same time. Remove prism.css ;)

@dkern
Copy link
Contributor Author

dkern commented Sep 11, 2017

Ha. Great. 👍 Typically user problem. 😉
Thanks for the hint!

So you don't want a PR/to add this to prism, correct? Then I'm hosting it by myself.

@Golmote
Copy link
Contributor

Golmote commented Sep 11, 2017

@LeaVerou Do you have an opinion on this? Should we add support for this Arduino specific C++?

@LeaVerou
Copy link
Member

@Golmote it could inherit from C++ and just redefine the parts that are different.

@Golmote
Copy link
Contributor

Golmote commented Sep 11, 2017

@LeaVerou Yes it's already what it does. I'll take that as a yes. ^^
@eisbehr- Feel free to submit a PR, then!

@dkern
Copy link
Contributor Author

dkern commented Sep 11, 2017

Will do! 😉

@Golmote Golmote closed this as completed Sep 11, 2017
@dkern
Copy link
Contributor Author

dkern commented Sep 12, 2017

Done. #1184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants