trilium_alchemy.core.note.content#

Class index#

Canonical

Content

Interface to note’s content.

ContentDescriptor

Override ExtensionDescriptor.__get__ to return the content itself via Content._get.

Symbols#

class trilium_alchemy.core.note.content.Content(entity: Entity)#

Bases:

trilium_alchemy.core.note.extension.NoteStatefulExtension

Interface to note’s content.

Access as Note.content, a descriptor mapping to an instance of this class.

The expected type depends on Note.is_string:

  • True: get/set str

  • False: get/set bytes

Get or set content as follows:

note.content = "<p>Hello, world!</p>"
assert note.content == "<p>Hello, world!</p>"

Todo

Helper Note.file to set content from file, automatically setting mime and #originalFilename.

Example:

note.file = "assets/my_content.html"
class trilium_alchemy.core.note.content.ContentDescriptor(attr: str)#

Bases:

trilium_alchemy.core.entity.ExtensionDescriptor

Override ExtensionDescriptor.__get__ to return the content itself via Content._get.