silverbullet/website/Attachments.md

36 lines
2.0 KiB
Markdown
Raw Normal View History

2024-08-15 22:39:17 +08:00
#level/beginner
2023-12-19 19:58:18 +08:00
While SilverBullet for sure is aimed at primarily text-based content, life can not fully be represented in text always. Therefore, SilverBullet supports attachments. Attachments, like [[Pages]] ultimately are — once again — just files on disk.
# Uploading
To create an attachment, you have a few options:
* Use the {[Upload: File]} command (especially useful on mobile devices)
* Drag & drop files or images onto a page
* Copy & paste files or images onto a page
All options will prompt you for a file name to use to store the attachment, and then include the attachment as an embedded image (if it was an image) or link to the file.
2024-06-23 03:14:48 +08:00
# Linking
Attachments can be linked to in two ways:
* Via the regular link syntax: `[link text](attachment.pdf)`. URLs here are relative to the page, so on a page named `MyFolder/Hello`, `[link text](attachment.pdf)` would refer to an attachment stored in `MyFolder/attachment.pdf`.
* Via the wiki link syntax: `[[attachment.pdf]]`. These paths are absolute and relative to your spaces root, just like regular page links. That is: on a page `MyFolder/Hello` an attachment link `[[attachment.pdf]]` would link to the file `attachment.pdf` in the spaces root folder.
# Embedding
2024-08-02 22:30:39 +08:00
Media can also be embedded using the [[#Linking]] syntax, but prefixed with an `!`:
Images, videos, audio and PDFs are currently supported.
2024-06-23 03:14:48 +08:00
* `![alternate text](image.png)`
* `![[image.png]]`
These follow the same relative/absolute path rules as links described before.
2024-08-02 22:30:39 +08:00
## Media resizing
2024-08-02 22:30:39 +08:00
In addition, media can be _sized_ using the following syntax:
2024-06-23 03:14:48 +08:00
* Specifying only a width: `![Alt text|300](image.png)` or `![[image.png|300]]`
2024-08-02 22:30:39 +08:00
* Specifying only a height: `![Alt text|x300](image.png)` or `![[image.png|x300]]`
2024-06-23 03:14:48 +08:00
* Specifying both width and height: `![Hello|300x300](image.png)` or `![[image.png|300x300]]`
2023-12-19 19:58:18 +08:00
# Management
SilverBullet [does not currently support](https://github.com/silverbulletmd/silverbullet/issues/72) any operations like renaming or deleting of attachments. Youll have to do this outside of SilverBullet somehow.