rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.34k stars 741 forks source link

Support for Salt (Saltstack) state files #396

Open Xiol opened 8 years ago

Xiol commented 8 years ago

Hi,

I initially raised an issue at the Gitlab issue tracker about Salt states being incorrectly detected. It appears they use this library, and you do not support Salt state files yet.

I believe at the moment they're being incorrectly detected as if we have an opening jinja tag, syntax highlighting breaks:

image

Salt states are a mixture of YAML and Jinja2, so I'm hoping adding support wouldn't be too complex.

aditaa commented 8 years ago

+1

bemeyert commented 8 years ago

We could really use that...

sevenval-admins commented 8 years ago

Would be awesome if you could add that.

oliver-dungey commented 8 years ago

+1, very hard to read at the moment

stale[bot] commented 5 years ago

This contribution has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.

baby-gnu commented 4 years ago

I'm interested by this feature.

pyrmont commented 4 years ago

I think this should have been tagged as a lexer request rather than as a bugfix. I've fixed that up (and removed the stale-issue tag which won't be added now that it's marked as a lexer request).

That said, I'm afraid that it might not have much practical impact. At this stage in its development, Rouge predominantly relies on submissions from its community for new lexers. We have documentation that can help with writing your own lexer and we encourage anyone who would like to see a language supported to give that a try.

If you do have any questions, feel free to file a PR with where you get up to and I'd be happy to help with a review or any answers I can provide.

baby-gnu commented 4 years ago

Thanks a lot @pyrmont

baby-gnu commented 4 years ago

I'm new to Rouge, I'm mostly interested by having nice colors in gitlab for my SaltStack sls files.

It should not be hard as I read but I wonder how to mix YAML and Jinja2, since sls files are just that by default.

I read some documentation before submitting and found the possibility to delegate.

I'll try to find some time to play with that.

Thanks.

pyrmont commented 4 years ago

@baby-gnu I'm not familiar enough with SaltStack to gauge that approach but definitely having a look at some of the other lexers is a great way to see what's possible. Oh, and I'm not sure how much help it will be given it's Python but perhaps have a look at the implementation in Pygments for ideas.

Good luck!