Documentation
¶
Overview ¶
Package linkhandler makes dictionary links in Markdown look words up in Bob.
Bob's Markdown view opens a link through macOS, and macOS can hand a URL only to an application bundle that registered its scheme. bob-mdict is a background process, not an application, so it keeps a tiny helper beside its data: an AppleScript applet, compiled on this machine by the system's own osacompile, that receives `bobmdict://lookup?text=…` and passes the text to Bob through Bob's documented AppleScript request (path "translate", action "translateText").
The applet is generated locally rather than shipped because a file created on the machine carries no download quarantine, so Gatekeeper never assesses it and an ad-hoc signature is all it needs. No developer certificate is involved, whichever way bob-mdict itself was installed.
Index ¶
Constants ¶
const AppName = "MDict Lookup.app"
AppName is the helper's bundle name. It is what macOS shows when it asks whether the helper may control Bob, so it says what the helper is for.
const Scheme = "bobmdict"
Scheme is the URL scheme the helper registers.
Variables ¶
var ErrUnsupported = errors.New("dictionary lookup links need macOS")
ErrUnsupported means links cannot be handled on this system.
Functions ¶
func BackURL ¶
BackURL is the link that returns to to, one step back along the path the reader took.
func Ensure ¶
Ensure installs or refreshes the helper in dir and registers it with Launch Services. It returns the helper's path. It is cheap when the helper is already current.
func LookupURL ¶
LookupURL returns the link that looks query up in Bob, or "" for a query no dictionary link would carry.
func NavigateURL ¶
NavigateURL is LookupURL for a link on the page of from: the helper tells the service where the reader came from before asking Bob, so the page that opens can offer the way back.
Types ¶
type PlayOptions ¶
PlayOptions are the reader's playback settings a play link carries: volume and rate as percentages, and whether to match loudness.