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
FR: Extensible Markdown Parser #1173
Comments
I've been wanting to do this. Good idea. |
Actually, I've just noticed that Laravel now requires league/commonmark instead of Parsedown. See laravel/framework#30982 and laravel/framework#30973 The league/commonmark library allows custom extensions to be created. I think I would want to change to commonmark, and then allow developers to add extensions, which would be used by |
If we switch to commonmark, need to make sure these work:
|
Would love to see the markdown parser become more extensible. Seems like this would just be a matter of adding an "alias class" on top of
ParsedownExtra
. Then we could use the service container to bind / alias a class which extends the markdown parser. Perhaps it could be calledMarkdownParser
and live in the statamic namespaces? This class would extendParsedownExtra
(which has no namespace).This would allow for v3 users and addon developers to easily build markdown extensions. For example, let's say you wanted to have a special content block for hot tips. 🔥 The markdown would look like this:
Currently
ParsedownExtra
is used in theMarkdown
fieldtype and in theStatamic\Support\Html
class.I just tried to use the service container to bind my own implementation of
ParsedownExtra
.... but this becomes problematic because that (vendor) class has no namespace. So once you overwrite the root namespace entry for it, you can't extend the base class.If this sounds like an acceptable FR, I'd be happy to make a PR to the proper v3 repository.
Thank you!
The text was updated successfully, but these errors were encountered: