/pdfjs-viewer/ is one Markdown page with a live preview of the viewer beside it.
- Prose: src/pdfjs-viewer/index.md. Headings
##and###make up the table of contents. - Attribute tables and playground controls: src/_data/pdfjsAttributes.js.
- Version numbers: read at build time from the installed
@missing-elements/pdfjs-viewer. The docs serve that package'sdist/as the live preview, so bumping the dependency updates both.
Add try after the language of a code fence to give it a ▶ Try button that applies the snippet to the preview:
```html try
<pdfjs-viewer-element src="/file.pdf" zoom="page-width"></pdfjs-viewer-element>
```- HTML snippets copy the attributes of their
<pdfjs-viewer-element>onto the preview.style,id,classand the placeholdersrc="/file.pdf"are skipped. - JavaScript snippets run as written.
document.querySelector('pdfjs-viewer-element')returns the preview element. - Sample addresses: in both kinds, the first
https://missing-elements.github.ioin an attribute's value, or in a script, is replaced by the origin the docs run on, so that a local preview plays its own samples (localUrlin src/pdfjs-viewer/docs.js). - Every Try button comes with a Reset button that puts the preview back to its defaults.
try=freshreplaces the preview with a new element first. Use it for settings that only apply when the viewer is built, such assetViewerOptionsand the "before connect" attributes.