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

Class to escape keep markup on certain code elements #2433

Closed
LeaVerou opened this issue Jun 26, 2020 · 3 comments · Fixed by #2434
Closed

Class to escape keep markup on certain code elements #2433

LeaVerou opened this issue Jun 26, 2020 · 3 comments · Fixed by #2434

Comments

@LeaVerou
Copy link
Member

I love Keep Markup, but it's interacting badly with a dynamic code snippet. It would be nice to be able to escape it on a case by case basis, in the same way one can escape whitespace normalization.

Perhaps a drop-markup or dont-keep-markup class?

@RunDevelopment
Copy link
Member

Why don't we implement a general opt-in/opt-out mechanism for plugins (where applicable)?
A class plugin-name will be used to activate a plugin for a given code block and a no-plugin-name can be used to deactivate it. Both classes are inherited, so you can de/activate a plugin for many code elements at once.
(Regarding the opt-out-class: no- works kinda well for all plugins but dont- works really well if followed by a verb, so why not have both?)

We can implement this as a little Prism.util function that, given a code element, the plugin name, and whether the plugin is active by default, will return whether the plugin is activated. Plugins can then juts call that function instead of each having their own logic for opt-in and opt-out.

We already have an opt-out for Normalize whitespace (not inherited) and opt-in for Line numbers (inherited). I feel like now is a good time to add a general mechanism.

@LeaVerou
Copy link
Member Author

Love the idea! Does that mean we can remove that logic from normalize whitespace?

@RunDevelopment
Copy link
Member

Yes! (See #2434.)

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

Successfully merging a pull request may close this issue.

2 participants