Feature Request: Allow InlineMentionParser to be a little more dynamic #473
Closed
Description
Description
Currently, in Drupal, we're having to reimplement this class to allow it to be a little more flexible so we can multi-purpose it. While we can certainly keep this up in our project, I figured these small additions might be something you'd be interested in porting upstream. If so, we wouldn't have to maintain our own version any longer.
Specifically, in two areas:
- Dynamic symbol:
- https://git.drupalcode.org/project/markdown/-/blob/1841fcb2d629ec40c8e83a3add861d2c871a36d2/src/Plugin/Markdown/CommonMark/Extension/InlineMentionParser.php#L45-46
- https://git.drupalcode.org/project/markdown/-/blob/1841fcb2d629ec40c8e83a3add861d2c871a36d2/src/Plugin/Markdown/CommonMark/Extension/InlineMentionParser.php#L74
- Dynamic link pattern handling (allowing a callable to be passed instead):
This allows us to, more easily, provide multiple ways to "map" an @
inline mention (entity, github, twitter and custom) as well as #
(entity, custom):
- https://git.drupalcode.org/project/markdown/-/blob/1841fcb2d629ec40c8e83a3add861d2c871a36d2/src/Plugin/Markdown/CommonMark/Extension/AutolinkExtension.php#L298-327
- https://git.drupalcode.org/project/markdown/-/blob/1841fcb2d629ec40c8e83a3add861d2c871a36d2/src/Plugin/Markdown/CommonMark/Extension/AutolinkExtension.php#L201-250
- https://git.drupalcode.org/project/markdown/-/blob/1841fcb2d629ec40c8e83a3add861d2c871a36d2/src/Plugin/Markdown/CommonMark/Extension/AutolinkExtension.php#L252-289