Add support for tempest/markdown in markdown-extra - #4890
Merged
Conversation
fabpot
approved these changes
Aug 13, 2026
Contributor
|
Thank you @ker0x. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
TempestMarkdown, an adapter fortempest/markdown, alongside the existingLeagueMarkdown,MichelfMarkdownandErusevMarkdownimplementations. It follows the same pattern as the others and accepts a pre-configuredTempest\Markdown\Markdownin its constructor, so rules and the highlighter can be customized.It is also appended as the last branch of
DefaultMarkdown's discovery chain, so projects that already have another library installed keep resolving to it exactly as before.PHP requirement
Every published version of
tempest/markdownrequires PHP^8.5, whiletwig/markdown-extrasupports>=8.1. So:require-devonly;composer installon PHP < 8.5, mirroring the existing conditional step used fortwig-extra-bundle;FunctionalTestonly adds it to the converter matrix whenTempest\Markdown\Markdownexists.The suite passes both with and without the library installed.
Test data change
Three cases in
getMarkdownTests()used Setext headings (Hellounderlined with=====).tempest/markdownonly implements ATX headings, so those were switched to# Hello. Those cases exercise the filter plumbing ({% apply %}, indentation stripping,include()|markdown_to_html) rather than the Markdown dialect, so no coverage is lost.Two patterns were also relaxed for the same reason:
<h1[^>]*>because Tempest emits auto heading ids, and<p>…\s*</p>because it keeps the source's trailing newline inside the final paragraph. Both remain accurate for the other converters.These differences, plus the fact that front matter is parsed out rather than rendered, are documented in a note in
doc/filters/markdown_to_html.rst.Unrelated one-liner
The last commit also adds
.php-cs-fixer.cacheto.gitignore— it is generated by the project's ownphp-cs-fixerdev dependency and was showing up as untracked. Happy to split it out if you'd rather keep this PR to a single concern.