Created
August 9, 2022 14:33
-
-
Save mitiko/30f65dd6198c594f5467c3c0d9ae4043 to your computer and use it in GitHub Desktop.
Style first 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
Ended up not liking how this looks and made a last word version as well.