BookmarkSubscribeRSS Feed
paulkaefer
Lapis Lazuli | Level 10

I submitted a request to add SAS language syntax highlighting in CodeRay. If you have a GitHub account, the least you can do is give the request a "+1".

 

If you have experience with (Ruby) regular expressions, you can contribute. Or if you can think of other good code examples, you are welcome to give me links or comment on the issue over at GitHub.

5 REPLIES 5
ChrisHemedinger
Community Manager

I have a customized set of rules for SAS code using prism.js -- that's what we use for SAS code highlighting here on SAS communities.  I'll be happy to supply that if you think it might help.  It's regex-based, along with a CSS file for how to color.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
paulkaefer
Lapis Lazuli | Level 10

That would be fantastic! I would definitely use it. Is it in a GitHub repository? If it isn't to be made public, you can email it to me.

paulkaefer
Lapis Lazuli | Level 10

The link you posted mentions SAS support already. I'm hoping your .js is more complete than this one (origin?), though anything would be useful.

ChrisHemedinger
Community Manager

Yes, mine has more stuff!

 

Here's a version of it in a GitHub Gist (prism-sas.js)  Also added my customized version of the prism.css file that addresses the new element types that I added.

 

The prism-sas.js contains basic regex patterns that are matched in precedence order.  It will match patterns from the top rule down to the bottom, and when it finds a match for the token it exits.  If you write a rule that isn't getting hit, it's because the token is hitting some other rule first.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
paulkaefer
Lapis Lazuli | Level 10

These look great! Thank you for sharing.

 

You should submit a pull request to Prism with these. They are big improvements upon what they already have, and other SAS+Prism users will benefit.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Discussion stats
  • 5 replies
  • 1596 views
  • 2 likes
  • 2 in conversation