Convert Markdown parser to CommonMark#133
Merged
bennothommo merged 6 commits intodevelopfrom Nov 28, 2022
Merged
Conversation
Drops the requirement for the Parsedown library.
LukeTowers
reviewed
Nov 25, 2022
bennothommo
commented
Nov 26, 2022
LukeTowers
added a commit
that referenced
this pull request
Nov 30, 2022
* develop: (63 commits) Resync model getAttribute override with base Laravel functionality Convert Markdown parser to CommonMark (#133) Improve support for multiple database connections (#132) Make the SectionParser more extendable (#131) Fix static analysis errors Fixed generation of thumbnails for remote disks Get local root path from configured disk Use named arguments add more testing with pivot data Add Str::isJson() | is_json() helpers Code analysis fixes Register slug rule as part of Validation singleton registration Add slug validation rule Use Laravel's CLI components Use Laravel's CLI components Prioritize local dynamic methods over behavior-provided methods (#130) Delete unneeded PHPUnit config Re-enable code analysis on develop branch Fix PHPStan testing, minor tweaks to docs Pass the full model through add() and remove() methods ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, our Markdown Parser uses the
erusev/parsedownanderusev/parsedown-extralibraries for Markdown parsing.Both libraries have not seen updates for a number of years (beyond README updates and a proposed 2.0 branch), and while they state they follow the GitHub-Flavoured Markdown specification, there are subtle incompatibilities with the spec. This PR proposes a move to
league/commonmark, which is already a dependency from Laravel, thus dropping a dependency from the Storm library.Beyond the fact that the CommonMark library is more readily maintained, it also adheres to the CommonMark specification, making its functionality documented and expected, and also adheres to the GitHub-Flavoured Markdown specification.
It is also incredibly customisable and extendable, and allows us to tailor an API for the Markdown parser to allow people to customise what they want to allow in Markdown parsing, whilst still maintaining parity with what people expect from the old API (which is still very much supported). I have imported the test cases from the Parsedown library to demonstrate that the proposed switchover should not have an effect on most usage.
This will probably require some slight adjustments to the Blog and Forum plugins (and the Docs plugin, which spurred this PR), but for the most part, I believe this should be a drop-in replacement.