rouge icon indicating copy to clipboard operation
rouge copied to clipboard

Support for Salt (Saltstack) state files

Open Xiol opened this issue 10 years ago • 10 comments

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.

Xiol avatar Feb 12 '16 17:02 Xiol

+1

aditaa avatar Mar 05 '16 01:03 aditaa

We could really use that...

bemeyert avatar May 10 '16 09:05 bemeyert

Would be awesome if you could add that.

sevenval-admins avatar May 10 '16 09:05 sevenval-admins

+1, very hard to read at the moment

oliver-dungey avatar May 10 '16 15:05 oliver-dungey

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.

stale[bot] avatar Jun 19 '19 16:06 stale[bot]

I'm interested by this feature.

baby-gnu avatar Mar 31 '20 08:03 baby-gnu

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.

pyrmont avatar Mar 31 '20 08:03 pyrmont

Thanks a lot @pyrmont

baby-gnu avatar Mar 31 '20 09:03 baby-gnu

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.

baby-gnu avatar Mar 31 '20 09:03 baby-gnu

@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!

pyrmont avatar Mar 31 '20 09:03 pyrmont