-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Question : how to work with multiple extends ? #534
Comments
You could probably hack it together by creating an additional pseudo-base that acts as a middleman to perform late dependency inversion (i.e. it is constructed using an array of objects that also extend Parsedown). The goal would be to rebuild some of the central "interface" to route markers to handler implementations in various Parsedown extensions. You could then utilise the reflection API to break the Lastly you'd need to implement your own handler calling methods ( All this glossing over potential recursion in specific extensions that might make you unable to apply the mix of markdown flavours in certain areas where recursion occurs (since they may defer directly to their own This is quite a bit of work for something that won't likely work very well, but it's an approach anyway 🤷♂️ . |
Hi Aidan Thank you for your answer. I've probably just understood 10% of it; please excuse me. It seems to be a huge work for, just, not write "class myOwnExtend extends ParsedownCheckbox" (in my example). If I need to hack classes of others authors, I don't win something... In fact, I was searching something like a plugin's approach i.e. writing a PHP class that will be called by the master class (parsedown). Thanks anyway for your very long and detailled answer. |
Hi all,
I didn't see directly how can I work with multiple extensions.
I'm using https://github.com/leblanc-simon/parsedown-checkbox/blob/master/ParsedownCheckbox.php of Simon Leblanc.
In my PHP, I've thus :
and it works like a charm, great.
I've also an another extend to handle image's size :
And it works but ... checkbox no more. It's quite logic since my call is
myOwnExtend doesn't know anything about ParsedownCheckbox since, the tree structure is something like this :
The solution would be, I suppose,
But I don't really want this because I can have several extensions... and ParsedownCheckbox can't be removed f.i.
Do you see a solution ?
I would like to call "as many" extensions I've of parsedownExtra ?
Thanks for your help.
The text was updated successfully, but these errors were encountered: