Documentation
¶
Overview ¶
Package reading is the desktop app's reading view (docs/design/app.md#reading-view, plan 0009): notesd renders the note as Markdown for native views (note.renderMarkdown, docs/specs/render.md#markdown-for-native-views), and MyGo's Markdown view draws it, with images read from notesd's blob store by hash (ADR-0023) and note embeds and callouts drawn from their fenced blocks. MyGo's view shows raw HTML as text, so a note runs nothing.
Index ¶
Constants ¶
const MaxImageFile = 128 << 20
MaxImageFile bounds the bytes of an image in the vault.
const ( // RefreshDelay is how long blocks wait after the vault changes before // those on screen render again, so an embedded note follows its edits. RefreshDelay = time.Second )
const RenderDelay = 300 * time.Millisecond
RenderDelay is how long the view waits after a change of the text before it renders again, as the web app's.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
Blocks draws pieces of a note as the reading view would, for live preview's callouts, tables, embeds and images: notesd renders each as if it were the note, and only those on screen are asked for. UI thread only.
func (*Blocks) Changed ¶
func (b *Blocks) Changed()
Changed says the vault changed: what shows renders again a little later.
func (*Blocks) SetRemoteImages ¶
SetRemoteImages refreshes blocks whose image load was previously refused.
type Links ¶
type Links struct {
// Note opens a note or file of the vault; newTab with Ctrl held.
Note func(path, subpath string, newTab bool)
// Tag searches the vault for a tag.
Tag func(tag string)
// URL opens a web link outside the app.
URL func(url string)
}
Links are where the view's links lead; the window wires them.
type Renderer ¶
type Renderer interface {
RenderMarkdown(ctx context.Context, p *api.NoteRenderMarkdownParams) (*api.RenderedMarkdown, error)
}
Renderer is what the view needs of notesd; api.NoteClient has it.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a tab's reading view of a note. UI thread only.
func (*View) Changed ¶
func (v *View) Changed()
Changed says the vault changed: what the note embeds may read otherwise.
func (*View) OnChange ¶
func (v *View) OnChange(fn func())
OnChange calls fn on the UI thread when a new rendering arrives.
func (*View) SetRemoteImages ¶
SetRemoteImages refreshes cached image results when the preference changes.