sethyuan / logseq-plugin-doc

Show page in a more document like look and provide quick exporting.
MIT License
90 stars 4 forks source link

When requesting an export, you can export the directory functionality together #18

Open lion-no-back opened 2 years ago

lion-no-back commented 2 years ago

I really like this plug-in you developed. It has been about two months since I started using it. It has brought me a lot of convenience. I just don’t know if it is possible to add the generated directory when exporting function is used

sethyuan commented 2 years ago

Plugins don't have that much permissions.

If what you want is to share the exported page, I'd recommend you to use Google Chrome to open the exported HTML and print it into a PDF file, for sharing. Just remember to check Background graphics. In this way, you'll practically have 100% accurate PDF conversion.

image

lion-no-back commented 2 years ago

Well, thank you for your suggestion. Sometimes the article is a bit long and the title is more, so I want to generate a directory, export it as an html file, and then I can do it offline, so that the gif image can be saved well, but the pdf does not have this. Thank you for your suggestion

sethyuan commented 2 years ago

Understood. It is certainly better to have a copy of all used resources when exporting. I'll keep this issue open and will make more researches on this topic.

acsr commented 2 years ago

Today I did some export with the new [[Logseq]] v0.8.7 und [[logseq-plugin-doc]] v1.11.1

Images are linked as absolute path to the PKM dir

I found out that after including Images AND moving the export around, the Images are linked statically to the Logseq PKM directory like [absolutepath]/assets/file.png (this is the main gotcha of this ticket).

I never recognized this due to the fact that I always converted the export to PDF in place of the original save location at once.

But now I needed to share the full export as working HTML with others.

What I did:

Icons missing

When you open the new HTML everything looks fine except:

Tabler Icons are gone, because Web Fonts are linked via relative link from CSS expected to be in the Logseq Plugin Directory relative to the original CSS.

Solution: Copy over the font files from ~/logseq/Export Hugo Docs/static/css/fonts/tabler-icons.* (on Mac!)

In Chrome Collected saves, TOC Links are absolute and refuse to work after moving the export.

Sideeffect of the Chrome Step: Links of a TOC from https://github.com/sethyuan/logseq-plugin-tocgen to the anchors are now absolute corresponding to the location during export from Chrome. I missed to check that before. The actual export is relative!

Solution: Search and Replace TOC Links to Anchors in the Chrome export html and remove the path before the character# starting the anchor link part.

New Image UI features in Logseq

There is a new challenge with Logseq 0.8.7 and the enhanced icon overlays over images.

The full (original) path and Delete and Copy Links are displayed together with the Show Full Size icons and their tooltips but without useful action.

You can now try to port back the HTML functionality to the export or try to hide the items in CSS. Both is useless for PDF as final target format.

Depending on the usecase the original path and exporting from there is useful or showing just the filename and offering a copy from the export.

The show fullsize icon functionality ist always important if you use images that are scaled down in the doc view but need to be explored in fullsize. This is still possible by opening with rightclick into a new tab, but cumbersome and not acceptable for others.

Conclusion

Except the manual postproduction work, I am now quite happy with the look and TOC functionality of the HTML. The actual export code is very clumsy and contains a lot of boilerplate, but this is not the fault of the plugin.

acsr commented 2 years ago

One more thought: Is it possible to include all resources as Base64 encoded data urls in a single big HTML file from Logseq? Sometimes a big monolith and not suitable, but also simple solution to avoid a directory if possible and acceptable.