Skip to content

Add support for tempest/markdown in markdown-extra - #4890

Merged
fabpot merged 1 commit into
twigphp:3.xfrom
ker0x:feat/tempest-markdown
Aug 13, 2026
Merged

Add support for tempest/markdown in markdown-extra#4890
fabpot merged 1 commit into
twigphp:3.xfrom
ker0x:feat/tempest-markdown

Conversation

@ker0x

@ker0x ker0x commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Adds TempestMarkdown, an adapter for tempest/markdown, alongside the existing LeagueMarkdown, MichelfMarkdown and ErusevMarkdown implementations. It follows the same pattern as the others and accepts a pre-configured Tempest\Markdown\Markdown in 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/markdown requires PHP ^8.5, while twig/markdown-extra supports >=8.1. So:

  • it is declared in require-dev only;
  • a CI step removes it before composer install on PHP < 8.5, mirroring the existing conditional step used for twig-extra-bundle;
  • FunctionalTest only adds it to the converter matrix when Tempest\Markdown\Markdown exists.

The suite passes both with and without the library installed.

Test data change

Three cases in getMarkdownTests() used Setext headings (Hello underlined with =====). tempest/markdown only 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.cache to .gitignore — it is generated by the project's own php-cs-fixer dev dependency and was showing up as untracked. Happy to split it out if you'd rather keep this PR to a single concern.

@fabpot

fabpot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Thank you @ker0x.

@fabpot
fabpot merged commit 2bb20e2 into twigphp:3.x Aug 13, 2026
53 checks passed
@ker0x
ker0x deleted the feat/tempest-markdown branch August 14, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants