blackhole89 / notekit

A GTK3 hierarchical markdown notetaking application with tablet support.
GNU General Public License v3.0
1.47k stars 62 forks source link

[Feature request] Export note to pdf or html document #53

Open Torkin1 opened 4 years ago

Torkin1 commented 4 years ago

Hello, I think it would be nice if i could export a tree (or a subtree) of notes as a pdf or html file, as it can be done in CherryTree software for example.

blackhole89 commented 4 years ago

How do you envision a (sub)tree (multiple notes) being represented in a single PDF file? Just concatenate all the notes together?

There's a stopgap solution to do something like what you want outside of the program right now which is to use pandoc, which generally does an okay job at converting markdown (including LaTeX math) into LaTeX-rendered PDFs. (I've encountered a handful of cases of it getting stuck though.) Eventually, adding an in-program export function is planned.

Torkin1 commented 4 years ago

How do you envision a (sub)tree (multiple notes) being represented in a single PDF file? Just concatenate all the notes

together? I was thinking about something like that. When exporting as HTML this should not be too difficult, since HTML files are already tree structured. When exporting as a PDF, it could simply concatenate all the nodes following their hierarchy, starting from the first node, then inlcuding their childs, then adding the next sibling node. I'm taking CherryTree as an example, I suggest you to go have a look at it if you don't mind. I really like the ability to take notes both with markdown and hand-written in the same place, so I really like your software. But at the moment lacks the exporting feature that other taking notes softwares already have. Thank you for listening to my feature request, cheers!

gcoimbra commented 4 years ago

There's an alternative that is grip. It's an pypi package that converts it to pdf.

Torkin1 commented 3 years ago

Hello @blackhole89 , sorry for writing under an old issue. I tried pandoc, but it seems it can't render drawings in PDF file.

original note: immagine

command invoked with its output:

$ pandoc appunti.md -o appunti.pdf 
[WARNING] Could not fetch resource 'nk:3572,eNq11k9IVEEcB/Cxv1ILbbFEBw9mFh6sVtyDUNDuex487GEPQhsstcUepCzs1h+Kl0Es/YE9epTQkjSzErXo4Ck8REREeIqOHiIkIoQi+v5mvlOzr2VTW4UPv3He7Px/M+97nVKdSqmdKvwXHNmhYzGFNPU53DyJRSrBPM3BLEU9pSJQT63QC/0QMC15H/k7IeWbIU4JUMkaKRurGX/MMxqgkW23st0OOkyS18Ky4fJxlk1CJ8smnHG0OvVKmQzkIMt0N+ShAD2MBeblWT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MC15H/k7IeWbIU4JUMkaKRurGX/MMxqgkW23st0OOkyS18Ky4fJxlk1CJ8smnHG0OvVKmQzkIMt0N+ShAD2MBeblWTZXy7moOjdRHW3/smy74PSvh+vXy7W8AUW4SSXOQ5Jz1+HMR8KZ1zTTdp46ORdJr9Zj2q7jc8+YcUzBJE3RBNyFIbgHIzAOL2AA+3SQ6rkn7Lp3Mdq9k3Hmz85ll7cWa7ZNx3nU/Z7ewVt4A6/gJczRaz6XcvOUCO3VuLOvu8kdg13buFfLcUR0/Ik6l+ArfIFF+AyfSPK+sYzyy/ucYL+S7GfG6X9mtfNf1sdNOu5Bu02wm5ooEdrjHf86x8rqXqfjPtSz1/9zrlZb80O+kYB2aIOD1EbtoWcHYL9vzi/3PGvkfo47/bf7Ok0ZqvV5k0V/jlLWcQxycBxOQJ5OQgFO0SLmaYHzJXdKM/eA5Ms7m4cMo73DZmg2Vev3cb05Q9ln6Z+9a6Jetd+ZO/gMyp+mcLrS/2fhHPXBeYqyPXsHR5z7zj7b5ay7fY9amCfPl1Jre89c8I2LdIkuwxW4CgFc81Vg9cN14/c3Rvget3s7FvoOsXNg93ttx7RRx+Qs0jBIko5xrq2Yt5z66nW4hXFSQOq2EUhUKSPKPS77fwPHGvFWOoYtOrJ+dQdtkLJsvsSccyakeVbYezDt5K1uPpt0eORrSuIY4ig8QPo+IgTDMIS0NcxnUkaM8vdPYRqeGcEMIgXTfDaF9KRpS7c3bihR4tmRd86RIr8FJvgNq7i2zTxD0xXuzwzvBHm/5OwZYR0DVKKgwrf2YGoNvwP/a+9v1mHUzLcimX+dHuMZLeeJPasXnfQK25G1DJ6U0+srFkL1y5qo5ZxlZe1sLRuP9P8h98EE8h5XaLeB73aDc4/abyp7HlV995fVrzodPvjOt9ffz9UPn/sx+QuhVcq6" "InvalReplacing image with description.

output file: appunti.pdf

Am I missing something?

sp1ritCS commented 3 years ago

Am I missing something?

NoteKit saves it's drawings as a zlib compressed serialization of a cairo surface (mostly for performance & size reasons). Pandoc can't deal with them. If you wan't to render a note with pandoc, you'll have to remove your drawings. However, if you copy a drawing into your clipboard, then into some other application (vim, gedit, emacs, etc.) and from there copy it again and back into notekit (notekit will be unable to show you the svg version tho) you should be able to export the drawing too.

Torkin1 commented 3 years ago

Is there any chance to implement this kind of workflow as a single button click? Anyway I don't want to use pandoc at all costs, any other simpler way would be good as well.

sp1ritCS commented 3 years ago

Is there any chance to implement this kind of workflow as a single button click?

we've talked about it in the notekit chat-room (mostly about a general "export" button, if we decide to add any other "non-standard" markdown features). Shouldn't be to hard, as the methods already exists.

Torkin1 commented 3 years ago

Ty for your swift answers. I'll wait then for the export feature to be implemented.

Torkin1 commented 3 years ago

oops closed by mistake, I'm very sorry :(

blackhole89 commented 3 years ago

Just committed something that adds an export button to the app menu. You can currently choose between the same rendered markdown format that you get if you copypaste into another program, and piping it into pandoc (which needs to be installed) to get a PDF.

Unfortunately, pandoc is a bit temperamental about certain things and can silently fail (check the console output in those situations). For example, it fails to detect LaTeX spans if the starting $ is followed by a space or the final one is preceded by one.

Torkin1 commented 3 years ago

Just committed something that adds an export button to the app menu.

Nice, ty very much. Since I'm using fedora, i'll wait for the copr repo to be updated as well to try out this update.

sp1ritCS commented 3 years ago

I'm using fedora, i'll wait for the copr repo

Thanks to @LyesSaadi, Fedora 34 now carries NoteKit (with cLaTeXMath chopped off) in it's repos.

Torkin1 commented 3 years ago

Thanks to @LyesSaadi, Fedora 34 now carries NoteKit (with cLaTeXMath chopped off) in it's repos.

didn't know, ty.

LyesSaadi commented 3 years ago

If you're already using the COPR repos, until the cLaTeXMath situation is fixed, you'll be able to keep using the cLaTeXMath features through the COPR without doing anything :D !

LyesSaadi commented 3 years ago

I've updated the COPR repo, and I will soon update the Fedora NoteKit as well ;) !

Torkin1 commented 3 years ago

thank you very much for your support! You can close the issue if you want.