zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.45k stars 1.93k forks source link

(Feature request) Export Notes option to include internal links #3399

Open deajan opened 1 year ago

deajan commented 1 year ago

Describe feature

When exporting notes, one can choose to export current note or current note with all its descendants. While this works well in hierarchy organized notes, it won't work with internal links.

It would be a nice to have function to export notes with all it's descendants and internal links, so the exported note would be complete, regardless of it's structure in Trilium.

Additional Information

No response

zadam commented 1 year ago

Hi, I'm not sure I understand. When you export a subtree into ZIP, the internal links (between notes within the exported subtree) are preserved. You can open the individual HTML files generated by the export and click through the links.

deajan commented 1 year ago

Internal links are preserved only when the internal link points to a note from the subtree.

Example:

root
 |
 |___NOTE 1
 |       |_______SUBNOTE 1
 |___NOTE 2
         |_______SUBNOTE 2

If NOTE 1 has two internal links to both SUBNOTE 1 and SUBNOTE 2, only SUBNOTE 1 is exported, leaving NOTE 1 incomplete.

zadam commented 1 year ago

Internal links are preserved only when the internal link points to a note from the subtree.

Yes, but I don't see how we could preserve links to notes which are not part of the export? They would be dead links anyway (since those target notes are not in the export). What purpose would that serve?

If NOTE 1 has two internal links to both SUBNOTE 1 and SUBNOTE 2, only SUBNOTE 1 is exported, leaving NOTE 1 incomplete.

TBH I don't understand this formulation. If SUBNOTE1 is exported then there's no internal link at all (it goes from NOTE1 to SUBNOTE1, not the other way round). I'm not sure what "leaving NOTE 1 incomplete" means in that case.

deajan commented 1 year ago

Yes, but I don't see how we could preserve links to notes which are not part of the export? They would be dead links anyway (since those target notes are not in the export). What purpose would that serve?

Indeed, as of today, my exports have dead links to notes outside of the export root. The point is not "preserve links", but rather include the linked notes in the export schema.

Here's a less conceptual example of what I am doing:

I have a knowledge tree for Linux (RHEL, Debian) and generic instruction notes that apply for every linux flavor (ie mysql or postfix config notes).

root
|______LINUX
           |________RHEL
           |         |_______LAMP stack (includes links to MySQL and Postfix)
           |         |_______ERP Server (includes links to Redis)
           |________DEBIAN
           |         |_______LAMP stack (includes links to MySQL and Postfix)
           |________Configurations
                     |_________MySQL
                     |_________Postfix
                     |_________Redis

When I export a RHEL documentation, I'll have:

Links between those 3 notes work.

Now the LAMP and ERP internal links to the configurations will be dead links. Since those links apply not only to RHEL, it's obvious to have them stored outside the RHEL tree.

It would be wonderful to have those linked notes exported too, regardless of their storage place, as long as the'yre linked to.

My reasoning behind this is that Trilium allows to structure notes in multiple ways to adapt to the cognitive process of the author. So exports should be complete regardless of the structure of the notes.

zadam commented 1 year ago

@deajan thanks, I now see what you mean.