mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
docs(dev): document exporting functionality
This commit is contained in:
27
docs/Developer Guide/!!!meta.json
vendored
27
docs/Developer Guide/!!!meta.json
vendored
@@ -1717,6 +1717,33 @@
|
||||
"format": "markdown",
|
||||
"dataFileName": "Hidden notes.md",
|
||||
"attachments": []
|
||||
},
|
||||
{
|
||||
"isClone": false,
|
||||
"noteId": "vphziLmQeQHY",
|
||||
"notePath": [
|
||||
"jdjRLhLV3TtI",
|
||||
"wbVIolLKDhe2",
|
||||
"vphziLmQeQHY"
|
||||
],
|
||||
"title": "Share",
|
||||
"notePosition": 260,
|
||||
"prefix": null,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "label",
|
||||
"name": "iconClass",
|
||||
"value": "bx bx-share-alt",
|
||||
"isInheritable": false,
|
||||
"position": 10
|
||||
}
|
||||
],
|
||||
"format": "markdown",
|
||||
"dataFileName": "Share.md",
|
||||
"attachments": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
30
docs/Developer Guide/Developer Guide/Development and architecture/Share.md
vendored
Normal file
30
docs/Developer Guide/Developer Guide/Development and architecture/Share.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Share
|
||||
## Share theme
|
||||
|
||||
The share theme represents the layout, styles and scripts behind the Share notes functionality. The current implementation is a heavy adaptation of [trilium.rocks](https://trilium.rocks/) which is a third-party share theme.
|
||||
|
||||
* The theme resides in `packages/share-theme`.
|
||||
* The HTML is defined in `src/templates` using EJS templating.
|
||||
* The `src/scripts` and `src/styles` subdirectories house the rest of the theme.
|
||||
|
||||
## Building the share theme
|
||||
|
||||
* In `packages/share-theme`, run `pnpm build` to trigger a build. This will generate `dist` which will then be used by the server.
|
||||
* Alternatively, use `pnpm dev` to watch for changes.
|
||||
|
||||
## Integration with the server for the share functionality
|
||||
|
||||
The server renders the templates using EJS templating from the share theme and hosts the assets.
|
||||
|
||||
* In dev mode, the templates and assets are served directly from `packages/share-theme/dist`.
|
||||
* Modifications to the assets (scripts or styles) will reflect without having to restart the server. However the share theme needs to be built first (see previous section).
|
||||
* Changes to the template will require a restart of the server, since they are cached. Simply press Enter in the console with `pnpm server:start` to quickly trigger a restart.
|
||||
* In production mode, the share theme is automatically built by the server build script and copied to `dist/share-theme`.
|
||||
|
||||
The server route handling this functionality is in `src/share/routes.ts`.
|
||||
|
||||
## Exporting to static HTML files
|
||||
|
||||
This functionality is also handled by the server, but in `src/services/export/zip/share_theme` instead. It works quite similar to the normal sharing functionality, but it uses `BNote` instead of `SNote` (and so on for other entity types), in order to work regardless of whether a note is shared or not.
|
||||
|
||||
The same templates are used and rendered by the server, except that they are stored in a file instead of served to web clients.
|
||||
Reference in New Issue
Block a user