Attachments

A note in Trilium can own one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.

This can be especially useful to include dependencies for your scripts. The Weight Tracker shows how to use chartjs which is attached to the script note.

Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.

Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced.

Types of attachments

There are two different types of attachment:

  • User content, representing files or images that are uploaded and part of the content of the note.
  • System attachments which are used internally by Trilium and can be of multiple types, including:
    • Collections to store information about views such as the column information for the Kanban Board.
    • Icons and cover images for Link Previews.
    • Debug information for some importers such as Microsoft OneNote (only if the debug flag was enabled at import time).
    • The transcript of a Meeting transcription, which is also shown above the note's content.
    • The SVG picture of a Canvas note (canvas-export.svg), and of each drawing canvas in a text note (see Drawing canvases in Include Note), used for previews and shared pages.

The system attachments are displayed at the end of the attachments list, in a dedicated section (Generated by Trilium).

Uploading attachments

The Attachments item of the Note menu opens the list of the note's attachments.

  • To upload files as attachments, press Upload attachments at the top of the list and select one or more files.
  • Alternatively, drag one or more files from the file explorer and drop them anywhere on the list. Pictures are compressed if Automatic image compression is enabled in Options → Media.

Attaching files from a text note

To attach files to a Text note and embed them in its content, press the Attach file button in the Formatting toolbar, choose Attach and embed file and select one or more files (see Embedding an attachment below). The same menu offers Image, which inserts pictures (see Images), and Attach file as a link, which links the files instead. Both file actions are also available as Attach file as a link and Attach and embed file in the Slash Commands. On a phone, the menu also offers Camera (see Mobile Frontend).

When files are attached as links:

  • Each file becomes an attachment of the note, and a link to it is inserted at the cursor. Several files produce several links, separated by a space.
  • While a file uploads, its link shows the file name and a toast shows the progress.
  • Pictures appear as links rather than images, and are attached exactly as they are, without being compressed. To display a picture in the text, use Image in the same menu instead (see Images).

Dragging a file that is not a picture from the file explorer onto the text also attaches it and inserts a link to it.

Right-clicking a link to an attachment shows the ways to open it, followed by actions on the attachment: opening it externally, downloading it, uploading a new revision, renaming or deleting it, and converting it into a note. In a text note being edited, the same entries are in the More actions menu of the popup of the link, which right-clicking the link opens. The popup also has a Download button.

Links follow changes to their attachment: renaming it updates the title they show, and deleting it removes them from the text notes open for editing at that moment. Converting it into a note turns its links into links to the new note.

Embedding an attachment

An attachment can be shown in the text instead of linked, the way Include Note shows a note: a picture is displayed, a PDF, a video or a document is previewed, a code or text file is shown with syntax highlighting, and a Markdown file such as a .md file is shown rendered. An embedded code file can also be edited in place (see Editing an include in place in Include Note), and an embedded Markdown file shows its source, its rendering or both, as an included Markdown note does (see Included Markdown there).

  • To attach files and embed them straight away, press the Attach file button and choose Attach and embed file. Each file gets an embed of its own, which shows the file name while the file uploads.
  • To embed an attachment that is already linked, right-click a link to it in a text note being edited and select Convert link to an embed, near the end of the menu.
  • A drawing canvas, inserted with Drawing canvas in the Insert menu, is an embed of a Canvas.excalidraw attachment that can be drawn on in place. An attached Excalidraw file (.excalidraw) is embedded as a drawing canvas too (see Drawing canvases in Include Note).
  • An embed gets the box size that suits the attachment, as a new included note does (see Box sizes there). To change its size, select the embed and use the box size menu in its toolbar, or the Size submenu of its More actions menu. A Resizable embed can also be resized by dragging its handles, and an Expandable one in height (see Resizing there). A Resizable embed can be placed at the left or the right of the note, with or without the text running beside it, from the Position submenu of its menu (see Positioning there).
  • An embed can have a caption, as an included note can (see Caption there).
  • To show only the attachment, turn off Show title in the embed's More actions menu, as for an included note (see Title there).
  • To open the attachment in a new tab, press the  (Open in new tab) button at the end of the embed's title.
  • An embed of size Compact shows only the title of the attachment and its size, in a single row, whatever the attachment is: a drawing canvas or a video shows nothing of its content there. Its buttons are Open externally and Download. An audio file at Compact is a row of player controls instead, without its title until Show title is turned on.
  • To show an embed of size Resizable or Full on the whole screen, press the  (Fullscreen) button at the end of its title. To return, press  (Exit fullscreen) in the top-right corner, or Esc.
  • To turn the embed back into a link, choose Convert to link in the menu that right-clicking the title row of the embed or pressing its More actions button opens. It is in the last group, after Delete block, which removes the embed from the note, and Delete attachment..., which deletes the attachment itself. Convert attachment into note... follows it.

An embed follows its attachment like a link does. Converting the attachment into a note turns the embed into an included note. In a shared note, an embedded picture is displayed with its caption, a drawing canvas as a picture of the drawing, and any other attachment, or a picture in a Compact embed, appears as a link to download it.

Converting notes to attachments

File notes can be easily converted to attachments of the parent note.

To do so:

  • For a single note, press the context menu from the Note menu and select Convert into attachment.
  • For multiple notes, select the given notes in the Note Tree, right click → Advanced → Convert to attachment….

Attachment previews

Attachments share the same content preview for images, videos, PDFs, etc. as the File note type. A Markdown attachment is previewed rendered, as a Markdown note is.