style1 — the default highlight list template
This is the default template function shipped with WuCai.
prefix— string prepended to each highlightsuffix— string appended to each highlightanno— string prepended to the annotationrefid— boolean, whether to append the block id to the highlight- Colour options
color_tags— array mapping colours to tagscolor— string used as a colour blockcolor_line— boolean, highlight the whole line- (if none of the three are set, no colour is applied)
- Links inside highlights
links— boolean, whether to merge links in the highlight into the highlight itself (>= 24.8.21)
Colour block before the highlight
jinja
{{ item | style1({prefix:"> ", anno:"> __note__: ", color:"█ "}) }}
Colour the whole highlight
jinja
{{ item | style1({prefix:"> ", anno:"> __note__: ", color_line:true}) }}
Append the block id
jinja
{{ item | style1({prefix:"> ", anno:"> __note__: ", color:"█ ", refid:true}) }}
style_dailynote (Daily messages only)
A template built for Daily messages, grouping them by date (to the minute) by default.
Use isdailynote to check whether the current note is a Daily note.
Note that style_dailynote takes highlights as its argument.
Example:
jinja
{% block highlights %}
{% if isdailynote %}
## Daily note
{{highlights|style_dailynote}}
{% else %}
## Highlights
{% for item in highlights %}
{{ item | style1({prefix:"> ", anno:"> __note__: ", color:"█ "}) }}
{% endfor %}
{% endif %}
{% endblock %}date
Formats a timestamp.
jinja
{{ createat_ts | date("YYYY-MM-DD") }} -> 2023-02-08
{{ createat_ts | date("YYYY/MM/DD HH:mm:ss") }} -> 2023/02/08 10:12:34YYYY year, MM month, DD day, HH hour, mm minute, ss second.
yaml_text
Use this when a value contains line breaks and needs to go into the property area.
jinja
pagenote: {{ pagenote | yaml_text }}yaml_field
A convenience function for the property area — it simplifies the template and improves performance.
Instead of:
jinja
{% if tags %}
tags: {{tags}}
{% endif %}you can write:
jinja
{{tags | yaml_field("tags:") }}yaml_list
Converts a list into an Obsidian property value.
Template engine
Templates are rendered by nunjucks.