Add CommonMark markdown rendering option #687
Merged
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.
Adds the option to use
league/commonmark
to parse and render markdown. This can be enabled by setting thecommonmark
config to any value. To configure the CommonMark environment or add extensions, thecommonmark
config can be set to an array withconfig
andextensions
keys:The default configuration includes 4 extensions: attributes, smart punctuation, strikethrough, and tables. Extensions can easily be added or removed by overriding the
commonmark.extensions
config key.Two other things:
MarkdownParserContract
is strictly necessary, and I wouldn't mind getting rid of it if we can, I just needed something to bind to.MarkdownParser
to take aMarkdownParserContract
in its constructor instead of aJigsawMarkdownParser
is not technically a breaking change, right? We're widening that type, so all possible existing scenarios there will keep working, and the$parser
property is not typed, so it could technically contain anything right now, which is also still the case. If someone's reaching into the underlying parser to do anything funky that would almost definitely break if they enabled this new parser, but it's optional so I think that's fine.