The document viewer lets a reader open Word, PDF, PowerPoint and Excel content inside an article or page. I keep the source document under content/assets/documents/ and use its site path. The preview opens in place without moving keyboard focus; a title belongs to the document element and appears once.

An article uses a standalone line in its Markdown body. Replace this example with a file you have added to the site:

!document[Project report](/documents/project-report.pdf)

For a JSON Page, place a document element inside one of the cell's element arrays:

{
  "type": "document",
  "title": "Project report",
  "src": "/documents/project-report.pdf"
}

The preview shows separated pages in a continuous reading area. Spreadsheets retain worksheet navigation; the surrounding controls follow the site palette while the document keeps its own colors. These formats have different parsing costs, so I check the actual sample instead of assuming every file streams with constant memory.

Text view defers the viewer until the reader requests it. A remote direct-file URL needs current service consent and permission from the source's CORS policy. Granting consent does not mean loading every document or widget. Check scrolling, keyboard focus, narrow screens and switching between full and text view with npm run build and a local preview.

Document viewer and samples · JSON Pages