Skip to content

Comments

Convert Markdown parser to CommonMark#133

Merged
bennothommo merged 6 commits intodevelopfrom
wip/convert-to-commonmark
Nov 28, 2022
Merged

Convert Markdown parser to CommonMark#133
bennothommo merged 6 commits intodevelopfrom
wip/convert-to-commonmark

Conversation

@bennothommo
Copy link
Member

@bennothommo bennothommo commented Nov 22, 2022

Currently, our Markdown Parser uses the erusev/parsedown and erusev/parsedown-extra libraries 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.

Copy link
Member

@LukeTowers LukeTowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bennothommo bennothommo merged commit a2959d9 into develop Nov 28, 2022
@bennothommo bennothommo added this to the v1.2.2 milestone Nov 28, 2022
@bennothommo bennothommo deleted the wip/convert-to-commonmark branch November 28, 2022 01:11
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
  ...
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

Successfully merging this pull request may close these issues.

2 participants