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

Syntax highlighting via Rouge #21

Open
daveyarwood opened this issue May 6, 2017 · 6 comments
Open

Syntax highlighting via Rouge #21

daveyarwood opened this issue May 6, 2017 · 6 comments

Comments

@daveyarwood
Copy link
Member

The syntax highlighting looks a little wonky because, with Alda being a new language, Rouge has no idea how to lex and highlight Alda code.

It seems like it shouldn't be too hard to create an Alda lexer for Rouge.

For reference: https://github.com/jneen/rouge#using-the-lexer-dsl

@stellarskylark
Copy link

I wrote the lexer at this PR. Is there any way to go ahead and get it into the website while waiting for it to be merged into the next build?

@daveyarwood
Copy link
Member Author

Hi, thanks so much for digging into this!

Unfortunately, it looks like there might be a bit of a backlog in Rouge PRs being merged... I found this one that was approved over a year ago and is still awaiting being merged; someone even left a comment asking about it 7 months ago and there hasn't been a reply.

So, I definitely think it's worth exploring what it would take to use the lexer you wrote to get better syntax on alda.io while we're waiting.

One thing we could do is make a fork of Rouge and depend on that instead of a release version. We're in a good position to do that, since alda.io is not hosted on GitHub Pages and thus we can use any version of Rouge that we want.

@stellarskylark
Copy link

I built my fork as a ruby gem, rouge-alda, but I'm having difficulty getting Jekyll to use it. As near as I can tell, if you specify anything other than rouge or pygments (and possibly some others) it just ignores it and silently uses the default. Thus, it still doesn't know about Alda, and won't highlight it.

See my fork of alda.io for the changes I made to the config. I also tried to specify a code block for alda syntax highlighting in tutorial.md, under the Multiple Instruments heading. You will notice that it does not apply any highlighting to it at all unless you instead specify a language that rouge already supports.

@daveyarwood
Copy link
Member Author

I checked out your forks and played around with them locally to see if I could get Jekyll to pick up on using rouge-alda instead of rouge, but I wasn't able to get it working. It seems like the Rouge dependency is sort of baked into Jekyll, and there isn't any way I can see to specify an alternative highlighter.

I think at this point, we might just be stuck waiting for Alda support to land in a release of Rouge, and then a release of Jekyll that uses the new Rouge version.

@daveyarwood
Copy link
Member Author

It's been several years since my last comment. I wonder if Alda support is available in Rouge now? 🤔

@UlyssesZh
Copy link

It's been several years since my last comment. I wonder if Alda support is available in Rouge now? 🤔

It seems that @stellarskylark recently (on Jul 7 this year) closed the pull request rouge-ruby/rouge#1014 without commenting a reason. Actually, in rouge-ruby/rouge#1063, a contributor of Rouge said that he had reviewed the pull request and confirmed that it can be merged as is.

Alda support is still not available in Rouge, but it could have been.

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

No branches or pull requests

3 participants