From dc6ee80ec85f4e49743dc634d6b047c33213589e Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 30 Apr 2026 19:47:47 +0200 Subject: [PATCH] anchor-aware refs in taskItem/itemItem/paragraphItem templates --- .../Library/Std/Infrastructure/Query Templates.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/Library/Std/Infrastructure/Query Templates.md b/libraries/Library/Std/Infrastructure/Query Templates.md index b4d1319c..359816ab 100644 --- a/libraries/Library/Std/Infrastructure/Query Templates.md +++ b/libraries/Library/Std/Infrastructure/Query Templates.md @@ -15,19 +15,22 @@ templates.fullPageItem = template.new([==[ * [[${name}|${name}]] ]==]) --- Renders a task object as a togglable task +-- Renders a task object as a togglable task. Anchor refs are bare names +-- (no @ or #) — prefix them with $ so the resulting wikilink resolves +-- through the anchor index. Position/header refs already contain @ or # +-- and pass through unchanged. templates.taskItem = template.new([==[ -* [${state}] [[${ref}]] ${name} +* [${state}] [[${string.find(ref, "[@#]") and ref or "$" .. ref}]] ${name} ]==]) -- Renders an item object templates.itemItem = template.new([==[ -* [[${ref}]] ${name} +* [[${string.find(ref, "[@#]") and ref or "$" .. ref}]] ${name} ]==]) -- Renders a paragraph object templates.paragraphItem = template.new([==[ -* [[${ref}]] ${text} +* [[${string.find(ref, "[@#]") and ref or "$" .. ref}]] ${text} ]==]) -- Renders a tag object