Skip to content

[6.x] Add a substring parameter to the mark modifier - #15955

Merged
jasonvarga merged 7 commits into
statamic:6.xfrom
edalzell:feature/mark-substring-parameter
Nov 20, 2026
Merged

jasonvarga merged 7 commits into
statamic:6.xfrom
edalzell:feature/mark-substring-parameter

Conversation

@edalzell

Copy link
Copy Markdown
Contributor

Summary

  • mark('substring:false') highlights whole words only, so two no longer matches inside network.
  • Omitting the argument, or passing substring:true, keeps the current substring matching.
  • The argument is removed before HTML attributes are built, so it does not render on the <mark> tag. The query is still the first remaining argument, or the q query string.
{{ text | mark('substring:false') }}
{{ text | mark('house', 'substring:false', 'class:highlight') }}

Modifiers only receive positional arguments, so mark(substring: false) does not pass the flag through.

Test plan

  • tests/Modifiers/MarkTest.php
  • Existing {{ text | mark }} usage still highlights inside longer words
  • mark('substring:false') leaves Network unmarked and still marks a standalone at

Pass substring:false to highlight whole words only. The default still matches inside longer words.
@edalzell edalzell changed the title Add a substring parameter to the mark modifier [6.x] Add a substring parameter to the mark modifier Nov 18, 2026
@edalzell
edalzell marked this pull request as draft November 18, 2026 00:54
@edalzell
edalzell marked this pull request as ready for review November 18, 2026 01:58
@jasonvarga
jasonvarga merged commit b9627fc into statamic:6.x Nov 20, 2026
61 checks passed
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