-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Github-Flavored Markdown #409
Conversation
…ecated and Cursor::getNextNonSpacePosition() can instead be used.
…date Added support for league/commonmark 0.16
Better parsing of escapes in cell
Table captions are not part of the CommonMark spec
Doesn't GFM have emojis? |
Great question! Emojis are actually implemented outside of their Markdown stack and are not part of the GFM spec extensions. Based on that, I think it makes sense to keep the |
Ah, interesting. I wonder what other features they have that are outside of the spec, other than the at mentions, and issue/commit links? |
@colinodell the 1.3.0 is released, could you put the migration things to docs as well? I was expecting something about it in 1.3.0 release notes: |
I've added information to the tag's release notes to help point people in the right direction. I also plan to release one more minor/bugfix release of each individual package with a Composer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extensions docs copy-paste does not work
This pull request adds complete GFM support to this library.
It will be an optional extension bundled with this library that anyone can easily use without needing to manually install and register external extensions.
Background
Historically, this library has tried to avoid including any functionality not present in the CommonMark spec. This included all features of Github-Flavored Markdown, such as tables. Due to popular demand, we did eventually release those as standalone packages under the
league/*
Packagist namespace. The idea was this would ensure proper separation and allow us to gradually develop and refactor those features over time.However, the burden to maintain those various extensions as completely separate packages has been difficult. Changes to the core parser were not automatically tested against those other extensions either. And perhaps the biggest problem was not having a single extension unifying all the GFM-related extensions together.
Bundled Extensions
The following extensions will be added to this library once 1.3.0 is released:
GithubFlavoredMarkdownExtension
, a brand new extension which includes all of the following:AutolinkExtension
(fromleague/commonmark-ext-autolink
)DisallowedRawHtmlExtension
(new extension)StrikethroughExtension
(fromleague/commonmark-ext-strikethrough
)TableExtension
(fromleague/commonmark-ext-table
)TaskListExtension
(fromleague/commonmark-ext-task-list
)Two other extensions are also being included in this PR, even though they're not part of the GFM spec:
SmartPunctExtension
(fromleague/commonmark-ext-smartpunct
)InlinesOnlyExtension
(fromleague/commonmark-ext-inlines-only
)Those two extensions are not part of the GFM spec, but they do provide useful functionality based on the core library and so including them here meets the goal of reducing the maintenance burden.
Deprecation and Migration
The following packages will be deprecated once
league/commonmark
1.3.0 is released:league/commonmark-extras
(basically was a meta-package for most of the GFM extensions below)league/commonmark-ext-autolink
league/commonmark-ext-smartpunct
league/commonmark-ext-strikethrough
league/commonmark-ext-table
league/commonmark-ext-task-list
league/commonmark-ext-smartpunct
league/commonmark-ext-inlines-only
Users of those packages may continue to use them, but support for issues and future compatibility will not be provided. Users will therefore be strongly encouraged to switch to the built-in GFM support provided in 1.3.0
Switching should be relatively painless for most people - the general gist is:
league/commonmark
1.3League\CommonMark\Ext\
namespace in your code toLeague\CommonMark\Extension\
composer.json
Extension Changes
For the most part, all of the extensions were imported as-is into this codebase with a single code-level change to the namespace:
A small number of other changes were made to specific extensions to align their behavior with the GFM spec, which may affect how some Markdown is parsed:
<input>
elements no longer look like<input />
(with that closing slash)