While SilverBullet is aimed primarily at text-based content, documents let a space contain source files, images, PDFs, audio, video, and other attachments. Documents, like pages, are ultimately just files on disk. Installed plugs can provide specialized editors, while built-in fallbacks edit UTF-8 text and display browser-supported media.
To create a document, you have a few options:
All options will prompt you for a file name to use to store the document, and then include the document as an embedded image (if it was an image) or link to the file.
By default the maximum allowed filesize for an upload is 10MB, you can change that with the maximumDocumentSize option.
config.set("maximumDocumentSize", 100)
Using ${widgets.commandButton("Navigate: Document Picker")} you can open the document picker, which displays all documents in your SilverBullet space. A blue extension indicates that an installed plug, the built-in text editor, or a browser media viewer can handle the document; gray indicates that the file opens externally. Unknown small files may still require a UTF-8 check when opened.
The built-in text editor accepts valid UTF-8 documents up to 5 MiB, with syntax highlighting for known source formats and plain text for other formats. In the host fallback, HTML, SVG, XML, JavaScript, and similar active content is edited as source rather than executed; the specialized image-viewer plug claims SVG first. Browser-supported images, audio, video, and PDFs can be viewed in the editor; media that the current browser cannot display opens externally.
Documents can be linked to in two ways:
[link text](document.pdf). URLs here are relative to the page, so on a page named MyFolder/Hello, [link text](document.pdf) would refer to a document stored in MyFolder/document.pdf.[document.pdf](<document.pdf>). These paths are absolute and relative to your space’s root, just like regular page links. That is: on a page MyFolder/Hello a document link [document.pdf](<document.pdf>) would link to the file document.pdf in the space’s root folder.Media can also be embedded using the #Linking syntax, but prefixed with an !. Images, video, audio, and PDFs are supported using the browser's native media elements and range-capable file responses.
These follow the same relative/absolute path rules as links described before.
In addition, media can be sized using the following syntax:
 or  or  or 