Thinking about moving to Obsidian from Trilium

Hello all!

What I’m trying to do

I’m currently using Trilium for a bunch of stuff and Obsidian looks like it has some features I’ve been missing a while so I’m thinking of moving over. What I’m looking for is a way to do the migration painless. Exporting a high level folder (and the children of that folder, et.c.) as markdown and opening in Obsidian comes a long way, but there are some problems however that seem to require a lot of manual work:

  1. I quite often write summaries in the “folder notes” which is not a thing (by default) in Obsidian
  2. The math formatting is different when exporting Trilium to markdown yielding a mix of \( and \[
  3. I use the canvas note type a bit in Trilium

Things I have tried

Possible solutions:

  1. I know there is a plugin for “folder notes”, but this does not work automatically, so I need to copy and create the folder notes manually after import which will be quite some work for a database 2+ years in the making. This is also annoying since every link to a folder note in Trilium is broken when importing into Obsidian so every link will have to be redone to the newly created folder note in Obsidian.
  2. There is a search and replace function in Obsidian (and a global search and replace plugin) but these does not seem to work with replacing the \( and \[ with $ and $$. (At least hasn’t in my testing thus far.) I could do this via the terminal and things like sed but this will probably require a lot of manual corrections.
  3. The canvas can be copy pasted from Trilium to Obsidian since they both use Excalidraw, but is there a way to get this over automatically?

Conclusion

I definitely want to move to obsidian at some point but I would like the transit to be as smooth and quick as possible. Hence I would like to ask if there is anyone else that has migrated from Trilium to Obsidian and has found a way to solve these problems in a nice way. Otherwise I know I just have to bite the bullet and put in the manual work to get everything nicely formatted in Obsidian.

Thanks in advance for you help.

How does Trilium export a folder note to markdown? Need to know that to help.

On your second point, folks having global search/replace seem to use vscode to make such changes, but there are also other programming editors that can do the job

1 Like

Hi again, sorry for taking so long to get back.

The upshot is that I got everything working, and since I dislike finding threads on the internet that ends with someone just saying: “it now works” without going into detail I’ll leave some information below:

The reason I asked here in the first place was because I got stuff like this in my export (which is on the Trilium side):


and some links were well behaved while other were like the one above. This was also my biggest question mark since if there was different formatting in different places it would be difficult to do a global search replace, but on exporting again some weeks later everything was more stable. Maybe there was some instability in exporting in one patch and I didn’t notice the fix and, anyhow, that is now resolved.

Since everything was now consistent I could do the search replace via sed.

With regards to the folder notes: Trilium exports folder notes as a folder and a markdown file with the same name, and thus with folder note plugins one can just manually move the notes into the folders with corresponding name. There can be some funky stuff with links to folder notes but that tends (from what I’ve seen) to be localised and fixable by hand when they arise. Your milage may vary depending on the complexity of linking between folder notes.

With regards to the canvas: I have not found an automatic way to export the canvas (i.e. excalidraw in Trilium) to the excalidraw plugin in Obsidian other than copy/pasting the contents of each file manually from Trilium to Obsidian.

Math conversion between Trilium and Obsidian

If someone comes looking for this in the future I leave the things I needed to change in the math notation and the reasoning below:

An sample math expression exported from Trilium:
\\\[Z\_g(\\mathfrak{s})=\\{X\\in \\mathfrak{g}:\[X,Y\]=0,\\ \\forall Y\\in\\mathfrak{s}\\}.\\\]
What we want:
$$Z_g(\mathfrak{s})=\{X\in \mathfrak{g}:[X,Y]=0,\ \forall Y\in\mathfrak{s}\}.$$

I.e. Trilium starts the export of inline math as \(<expression>\) and display math as \[\], then every \ gets another \ prepended and each [ is also prepended with \, hence we get the triple backslash before the [ in the Trilium export. This also indicates the ordering below.

Also: Due to this prepending of \ the order of these is search and replace events is important. Or at least 1 needs to be first and 2/3 needs to happen before 6/7, otherwise they should be independent.

Notation: “source” (i.e. string exported from trilium) → “target” (i.e. the string I want in Obsidian)

  1. \\ -> \
  2. \[ -> [
  3. \] -> ]
  4. \( -> $
  5. \) -> $
  6. \[ -> $$
  7. \] -> $$
  8. \_ -> _
  9. sube -> subseteq
  10. supe -> supseteq

With these replacements I have note yet seen any error in my math import.

2 Likes