electron-highlighter / atom

Syntax theme for Atom editor

Home Page:https://atom.io/themes/electron-highlighter-syntax

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Curly brackets and %

mkschulze opened this issue · comments

Hello,

this is a nice Syntax Theme for sure! Would you mind adding styles for curly brackets {} and maybe for the % symbol? I'm not sure how to go about that.

Would be great thx!

Hey @Lucid-Network - what language specifically is missing this? Could you provide a screenshot? I'd be happy to get that in.

Hi!

So i am working with the web framework django and whenever i want to do some string substitution i have to include this:

{% something %}
and
{{ block.super }}

So if that is even possible it would be really awesome to make Atom color these, whenever it is written {% and {{ .

Here is a screenshot from a HTML document.
bildschirmfoto 2017-10-23 um 06 29 50

Also there is some room for further coloring in python, like:

bildschirmfoto 2017-10-23 um 06 30 31

Maybe here it would make sense to color the = symbol and also what is written after a . like

name = models.CharField(max_length=120)

Thanks a lot!
Mark

Thanks for the feedback and the screenshots! Super helpful.

There's only so much I can do from a syntax-theming perspective, and I've run into the same thing with other HTML templating languages. What you probably want to do is install a package that adds support for a new grammar, which is what the editor uses to add the syntax highlighting classes to your code. For the HTML templating, something like the django-templates package is probably what you need. Here is a snippet of your same code above after installing that package:

image

As is the case with any grammar package like that, you'll either have to do some configuration in the settings to tell it when to apply Django template syntax vs regular HTML syntax, or you'll have to manually set the syntax per-file.


Re: the Python syntax highlighting... this is unfortunately not something I have control over. Upon inspecting the code elements, those strings of text are not differentiated in the python language grammar, so it won't add separate classes to them. That would likely involve a PR in the language-python repo.

However, the = operator I do have control over. I actually style it differently for JavaScript files, but it appears they have added a class (syntax--assignment) that gives me more control over the style of that operator in all languages. I'll dig into that and do some testing to make sure it all looks solid, but that would be a super quick enhancement and definitely something I'd like to add in. Look for a PR shortly!

If you think that works, let me know and I'll close this issue when I merge that PR 😄

Thanks again for the feedback!