Related to I wonder if SilverBullet could take advantage of the “URL text fragment” standard 🤔 and Getting the start of line where cursor is?
I assume there are a lot of people who have secretly implemented this? hhhh… Are there many people like me who love to goto anywhere in their documents? XD
command.define {
name = "Cursor: Copy Reference",
key = "Shift-Alt-c",
run = function()
local pageName = editor.getCurrentPage()
local pos = editor.getCursor()
local ref = string.format("[[%s@%d]]", pageName, pos)
editor.copyToClipboard(ref)
editor.flashNotification("Copied reference: " .. ref, "info")
end
}
Compared to the alternative of planting one immutable (but invisible) anchor and jumping to it, the current technique streamlines operations but raises maintenance concerns if the document is edited (pos-word map might change).
Hence, a smarter method — like the one referenced in I wonder if SilverBullet could take advantage of the “URL text fragment” standard 🤔
or an equivalent implementation — may be warranted (from SB directly?) :
SilverBullet’s backlinks effectively re-evaluate cursor positions so they update when the source moves (However, it seems that when [[A Page]] appears at the end of B Page, the backlink from A Page to B Page does likely not return to the correct position: v2.1.9 tiny bug - the cursor does, but the view does not: view always at the top. emmmmmmmmm, Now I cannot replicate this bug -_-||).
In essence, there are three precise forms of reference, with stability typically increasing in that order:
- addressing a specific character position or line;
- referencing a given piece of text (or a textual pattern);
- referencing a visible or invisible label/anchor.
I previously implemented an automated backlinks-enabled, yet LaTeX-based version of strategy 3. Is anyone interested in achieving a similar effect (i.e. Cursor-level fine-grained forwardLink with Automatic BackLinks) in SilverBullet?