MarkdownPreview.svelte

Rendered markdown, read-only — a file's content, or any markdown string. Scrolls on its own, so it can sit beside an editor; it takes focus like an editor does (focus_key), so arrow keys scroll it.

Its links never navigate the app. An external link opens in a new tab, an in-document #fragment scrolls the preview, and — given the file's path — a relative link opens the indexed file it names in a tab (see markdown_links.ts), a preview tab on a plain click and a kept tab on a middle- or Ctrl/Cmd-click; a link to a folder opens its README. Links the file index says are missing are marked broken, and ones it can't see marked unknown, each with a title saying why. Anything else — without a path, any relative link — does nothing.

view source

Declarations
#

MarkdownPreview
#

MarkdownPreview.svelte view source

import MarkdownPreview from '@fuzdev/zzz/MarkdownPreview.svelte';

path?

The absolute path of the file rendered — without it, relative links are inert.

type string | null
optional

focus_key?

Focuses the preview when pending_element_to_focus_key equals it, then clears that.

type string | number | null
optional

pending_element_to_focus_key?

type string | number | null
optional bindable

attrs?

Attributes for the scroll container.

type HTMLAttributes<HTMLDivElement>
optional

content?

The markdown source to render.

type string
optional

nodes?

type MdzNode[]
optional

links?

type readonly MarkdownLink[]
optional

Depends on
#

Imported by
#