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

Adding prism plugins #22

Open
AlexanderZeilmann opened this issue Jan 7, 2022 · 5 comments
Open

Adding prism plugins #22

AlexanderZeilmann opened this issue Jan 7, 2022 · 5 comments

Comments

@AlexanderZeilmann
Copy link

Is there a way to use prism plugins and especially the treeview plugin?

As far as I understand refractor does not allow prism plugins, but it should be possible to add support for the treeview plugin by registering its syntax definitions with refractor.
For this to work rehype-prism-plus would need to allow registering new syntaxes with its refractor instance.

What do you think?

@timlrx
Copy link
Owner

timlrx commented Jan 8, 2022

I have refactored the code to export a rehypePrismGenerator that you can pass in any refractor object and customise your desired languages.

Unfortunately, the treeview plugin does some manipulation on the dom so it can't be simply imported. That section of the code probably needs to be ported over to rehype-prism-plus for everything to work as intended.

@timlrx
Copy link
Owner

timlrx commented Jan 8, 2022

Tried just initializing the plugin and commenting out the addition dom modifications. Here's how it looks. Top code block is without the plugin and the bottom one is with the plugin and CSS loaded.
image

The modification actually looks pretty straightforward. Let me know if you want to help port it over? Or I will take a stab over the next few days.

@AlexanderZeilmann
Copy link
Author

Ahh good to know that it works. I only got a nondescriptive error message. I will try it a again in the next few days.

@AlexanderZeilmann
Copy link
Author

Hmm, sadly I did not figure out how to do it 🙁 Can you post your solution?

@timlrx
Copy link
Owner

timlrx commented Feb 5, 2022

Most certainly, will take a stab at it and let you know again when it is done.

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

No branches or pull requests

2 participants