This sample is intentionally longer than a placeholder README. It checks whether the Markdown renderer keeps a clean reading surface in both light and dark system themes while still preserving tables, block quotes, task lists, links, and code fences.
.md and .markdown files to the Markdown renderer.A preview component should feel quiet and dependable. The surrounding app can adapt to the user's theme, but document content must remain legible and predictable.
| Format family | Example file | Rendering strategy | Print button |
|---|---|---|---|
| Markdown | markdown.md |
Marked + GitHub Markdown CSS | Available |
| Source code | code.ts |
highlight.js, language loaded on demand | Available |
| Word | word.docx |
Dedicated page export adapter | Available |
pdf.pdf |
Dedicated page export adapter | Available | |
| Typst | report.typ |
WASM compile + paged SVG export adapter | Available |
| Excel | excel.xlsx |
Virtual table for large sheets | Hidden by design |
When a file URL does not expose an extension, wrap the downloaded Blob as a
File with a real name before passing it to the viewer:
async function openAuthenticatedFile(url: string) {
const response = await fetch(url, { credentials: 'include' })
const blob = await response.blob()
return new File([blob], 'contract.pdf', { type: blob.type })
}
The operation hooks can be used to guard sensitive actions such as printing or downloading:
const options = {
toolbar: { download: true, print: true, exportHtml: true },
beforeOperation(context) {
if (context.operation === 'print') {
return window.confirm(`Print ${context.filename}?`)
}
return true
}
}
File preview when your application handles authentication itself.The text in this section should remain readable when the browser is in dark
mode. Inline code such as operation-availability-change should not fade into
the paper, and table borders should stay visible without looking heavy.
{
"viewer": "flyfish",
"theme": "isolated document surface",
"formats": ["pdf", "docx", "xlsx", "ofd", "typst", "geojson", "midi", "sqlite", "markdown", "code"],
"buttons": {
"download": true,
"print": "dynamic",
"exportHtml": true
}
}