## Understanding the source code of the different notes

Internally, the structure of the content of each note is different based on the Note Types.

For example:

- Text notes are represented internally as HTML, using the CKEditor representation. Note that due to the custom plugins, some HTML elements are specific to Trilium only, for example the admonitions.
- Code notes are plain text and are represented internally as-is.
- Geo Map notes contain only minimal information (viewport, zoom) as a JSON.
- Canvas notes are represented as JSON, with Trilium's own information alongside with Excalidraw's internal JSON representation format.
- Mind Map notes are represented as JSON, with the internal format of MindElixir.

Note that some information is also stored as Attachments. For example Canvas notes use the attachments feature to store the custom libraries, and alongside with Mind Map and other similar note types it stores an SVG representation of the content for use in other features such as including in other notes, shared notes, etc.

Here's part of the HTML representation of this note, as it's stored in the database (but prettified).

    <h2>
    	Understanding the source code of the different notes
    </h2>
    <p>
    	Internally, the structure of the content of each note is different based on the&nbsp;
    	<a class="reference-link" href="#root/_help_KSZ04uQ2D1St">
    		Note Types
    	</a>
    	.
    </p>

## Viewing the source code

It is possible to view the source code of a note by pressing the contextual menu in Note buttons and selecting Note source.

The source code will be displayed in a new tab.

For some note types, such as text notes and JSON notes, the source code is also formatted in order to be more easily readable.

## Modifying the source code

It is possible to modify the source code of a note directly, however not via the Note source functionality.

To do so:

1. Change the note type from the real note type (e.g. Canvas, Geo Type) to Code (plain text) or the corresponding format such as JSON or HTML.
2. Confirm the warning about changing the note type.
3. The source code will appear, make the necessary modifications.
4. Change the note type back to the real note type.

Depending on the changes made, there is a risk that the note will not render properly. It's best to save a revision before making any big changes.

If the note does not render properly, modify the source code again or revert to a prior revision. Since the error handling for unexpected changes might not always be perfect, it be required to refresh the application.