feat(nvim): conceal wiki-link ids to styled name hyperlinks (§8.4)

`conceal.lua` hides the `[[id|` prefix and `]]` suffix with conceal
extmarks (refreshed on edit), leaving the label as a styled `HephLink`;
`conceallevel=2` + empty `concealcursor` reveal the raw `[[id|Name]]` on
the cursor's line so it stays editable. The `[[` picker now inserts the
labelled `[[id|Name]]` form (readable + conceal-ready; collapses to bare
on save). e2e asserts the conceal extmarks + conceallevel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-06-03 12:35:24 -07:00
commit fd010a7066
6 changed files with 103 additions and 6 deletions

View file

@ -94,8 +94,16 @@ function M.insert()
if not choice then
return
end
local id = choice.__create and rpc.call("node.create", { kind = "doc", title = choice.title }).id or choice.id
vim.api.nvim_put({ "[[" .. id .. "]]" }, "c", true, true)
local id, title
if choice.__create then
local node = rpc.call("node.create", { kind = "doc", title = choice.title })
id, title = node.id, node.title
else
id, title = choice.id, choice.title
end
-- Insert the labelled form `[[id|Name]]` (readable + conceal-ready); it
-- collapses to the canonical bare `[[id]]` on save (§8.4).
vim.api.nvim_put({ "[[" .. id .. "|" .. title .. "]]" }, "c", true, true)
end)
end)
end