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

Lacking documentation: How to make a Rouge Lexer in a non-Rouge gem? #2020

Open
dhendriks opened this issue Jan 12, 2024 · 0 comments
Open
Labels
docs-request A request for documentation to be developed.

Comments

@dhendriks
Copy link

I found https://rouge-ruby.github.io/docs/file.LexerDevelopment.html with instructions on how to make a Rouge Lexer, and contribute it to Rouge. I was able to use the instructions quite easily to make a custom Lexer. However, what I can't find is how to distribute the Lexer in a separate gem, and have Rouge work with that (thus, be able to find and load it). How would one go about that?

What I found is that Rouge loads lexers using a hardcoded relative path, namely rouge/lexers. I did not find any code that makes it look elsewhere.

Since you're probably going to ask why I want this: If I update the language I'm developing, and for instance add a new keyword, I want to be able to include the new syntax in my project's documentation. This means I need a new version of the lexer to highlight for instance the new keyword. But, if the lexer is part of Rouge itself, I need a new version of Rouge, before I can do a release of my project. Therefore, it would be good if I could include my own lexer in my own project, to not be dependent on new Rouge releases. This doesn't mean I shouldn't also contribute it to Rouge itself, but I'd like to be able to also have it as part of my own project.

@dhendriks dhendriks added the docs-request A request for documentation to be developed. label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-request A request for documentation to be developed.
Projects
None yet
Development

No branches or pull requests

1 participant