Last active
August 9, 2022 14:38
-
-
Save mitiko/3296ed5f3cfeefd90006b6fce88546cf to your computer and use it in GitHub Desktop.
Style last word with a Tera macro
This file contains 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
{% macro style_first_word(string) %} | |
{% set words = string | split(pat=" ") %} | |
{% set first_word = words | first %} | |
{% set remaining_words = words | slice(start=1) | join(sep=" ") %} | |
<span class="first-word"> | |
{{ first_word }} | |
</span> | |
{{ remaining_words }} | |
{% endmacro style_first_word %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage and backstory: https://gist.github.com/Mitiko/674443e532031587b043d1b432c54a95