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

find a cleaner way to extend ParsedownExtra with multiple extensions #2

Closed
raffaelj opened this issue Nov 3, 2020 · 1 comment
Closed

Comments

@raffaelj
Copy link
Owner

raffaelj commented Nov 3, 2020

I use ParsedownCheckbox and ParsedownToC extension. To let them work together, I had to use a dirty and unpredictable trick:

Because of the weird extension behaviour of Parsedown, I had to copy/paste the original ParsedownCheckbox class with a namespace modification. So running composer update will not effect that class without manual adjustments.

use \ParsedownToC as ParsedownExtra;
class ParsedownCheckbox extends ParsedownExtra

see: https://github.com/raffaelj/cockpit_BetterMarkdown/blob/master/Helper/Markdown.php#L158-L174

Parsedown 2.0 will have a cleaner method, but it is not released, yet.

The current solution could also break, if these extensions share similar methods and variables in a future update.

@raffaelj
Copy link
Owner Author

fixed with c83d0a2

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

1 participant