My collection of scripts for use with trilium

root authored 19 days ago
htb2trilium update to work with TriliumNext 0.92.6 19 days ago
README.md initial commit 1 month ago
highlight_moodlog.js initial commit 1 month ago
highlight_todotxt.js initial commit 1 month ago
trilium_sync.php initial commit 1 month ago
README.md

TriliumScripts

Collection of scripts for use with trilium

syntax highlighting

highlight_moodlog.js & highlight_todo.js - Both of these will apply appropriate syntax highlighting to the specific note.

installation

1) add the code as the notes contents.

2) set "note type" to "JS frontend"

3) add an "owned attribute" of "#widget"

use

on the note you want highlighting set the "owned attributes" to "#todotxt #hideHighlightWidget" or "#moodlog #hideHighlightWidget" depending on which syntax type you want to highlight

bidirectional sync

trilium_sync.php - script to keep a folder of local text files and a trilium note in sync.

installation

Edit the config values at the top of the script to match your trilium setup. Run it manually to test it is working as expected. If it is create a cron job.

example use

$> php trilium_sync.php 
[i] checking connections
[i] version: x.xx.x
[i] gathering info

- Folders -
Folder/Path              Folder Name              Parent       noteId       Mod Trl    Mod Dsk    Status         
Synced/                  Synced                   root         j0DRZhIzV97W 1742502936 1742507367 Exists
Synced/BothPlaces/       BothPlaces               j0DRZhIzV97W AQb3Dg0yZHSu 1742507075 1742507200 Exists
Synced/[del] tobe del/   [del] tobe del           j0DRZhIzV97W j0xUs1FdZL1Y 1742507321            Missing_Disk   
Synced/AddToTrilium/     AddToTrilium                                                  1742507383 Missing_Trilium
Synced/tobe deleted/     tobe deleted                                                  1742507200 Missing_Trilium
- Files -
Folder/Path              Filename                 Parent       noteId       Mod Trl    Mod Dsk    Hash  Status         
Synced/BothPlaces/       UpdateDiskFile           AQb3Dg0yZHSu IwUZLwWdbiWG 1742507314 1742507199 Diff  Update_Disk    
Synced/BothPlaces/       UpdateTriliumFile        AQb3Dg0yZHSu 7pMPgsb9AVRf 1742507130 1742507345 Diff  Update_Trilium 
Synced/[del] tobe del/   gone_also.txt            j0xUs1FdZL1Y 4wOoHDy07csr 1742507178            N/A   Missing_Disk   
Synced/AddToTrilium/     fromDiskToTrilium.txt                                         1742507394 N/A   Missing_Trilium
Synced/tobe deleted/     gone_also.txt                                                 1742507200 N/A   Missing_Trilium

[-] deleting disk folder: /mnt/hgfs/PentestOS/Misc/trilium_sync/Synced/tobe deleted/
[+] creating trilium folder: Synced/AddToTrilium/
[+] creating trilium note: /mnt/hgfs/PentestOS/Misc/trilium_sync/Synced/AddToTrilium/fromDiskToTrilium.txt
[+] updating file on disk: /mnt/hgfs/PentestOS/Misc/trilium_sync/Synced/BothPlaces/UpdateDiskFile
[+] updating file on trilium: /mnt/hgfs/PentestOS/Misc/trilium_sync/Synced/BothPlaces/UpdateTriliumFile
Buy Me A Coffee