Skip to content

Conversation

@ossobuffo
Copy link
Contributor

This is a feature request to add a highlight extension to Commonmark (see the Markdown Guide's documentation on this feature). This extension is not loaded by default, but is available for implementations that want to support highlighting.

This was quite straightforward, since it merely involved copying and modifying the Strikethrough extension and its tests.

The one unanswered question I have is whether mark is the correct return value for getXmlTagName() for this extension.

@colinodell
Copy link
Member

Thanks for suggesting this!

Although I've been hesitant to include new extensions in this library, I'm inclined to include this one because:

  • The implementation is small, making the maintenance burden trivial
  • Most (all?) parsers that do support highlights seem to use this syntax

The one unanswered question I have is whether mark is the correct return value for getXmlTagName() for this extension.

Yep, that works for me!

There are a few small changes I think we should make:

  • Rename the extension itself to Highlight, but continue using Mark for the inline element type
  • Fix the failing pipelines (code style, and copypaste errors in tests)
  • Add this to the docs

I've got some free time now, so I'll give that a go :)

@colinodell colinodell self-assigned this Nov 26, 2025
@colinodell colinodell merged commit b703d32 into thephpleague:main Nov 26, 2025
18 checks passed
@colinodell
Copy link
Member

Thanks for contributing this! I'll include this in the next minor release (v2.8.0)

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