zealdocs / zeal

Offline documentation browser inspired by Dash
https://zealdocs.org
GNU General Public License v3.0
11.53k stars 784 forks source link

rfc: Using litehtml as the html viewer #1595

Open Waqar144 opened 10 months ago

Waqar144 commented 10 months ago

Currently zeal uses Qt WebEngine for showing the documentation. While it is great, it is also a huge dependency and effectively makes the app more or less equivalent to an electron app. I think litehtml is a library that can be used instead of Qt WebEngine, which is a lightweight html renderer.

Advantages:

Disadvatages

Switching wont be a huge effort. I have a wip branch that can be used to try it out. I have only tested it with Qt documentation. If there are documentations that need javascript to work correctly then probably the switch can't be made.

barolo commented 9 months ago

I have problems building your branch, it is still trying to build itself against webengine. ~~got wrong source, now it compiles but fails at end, during linking qlitehtml, I have checked the submodule out. ld: cannot find -lqlitehtml: No such file or directory~~ Now it fails at building qlitehmtl, and I'm stuck, with errors like: 3rdparty/qlitehtml/src/container_qpainter_p.h:61:52: error: ‘tchar_t’ in namespace ‘litehtml’ does not name a type 61 | litehtml::uint_ptr create_font(const litehtml::tchar_t *faceName,

Waqar144 commented 9 months ago

~ Now it fails at building qlitehmtl, and I'm stuck, with errors like: 3rdparty/qlitehtml/src/container_qpainter_p.h:61:52: error: ‘tchar_t’ in namespace ‘litehtml’ does not name a type 61 | litehtml::uint_ptr create_font(const litehtml::tchar_t *faceName,

Its probably conflicting with your system litehtml. You will have to uninstall it / force the litehtml git submodule to be used by editing the CMakeLists.txt in qlitehtml. I haven't fixed this properly yet.

barolo commented 9 months ago

~ Now it fails at building qlitehmtl, and I'm stuck, with errors like: 3rdparty/qlitehtml/src/container_qpainter_p.h:61:52: error: ‘tchar_t’ in namespace ‘litehtml’ does not name a type 61 | litehtml::uint_ptr create_font(const litehtml::tchar_t *faceName,

Its probably conflicting with your system litehtml. You will have to uninstall it / force the litehtml git submodule to be used by editing the CMakeLists.txt in qlitehtml. I haven't fixed this properly yet.

This seems to be the case, also the system's litehtml is in its latest version [0.9]. Correct me if I'm wrong but qlitehtml seems to be using quite old version of lite [0.6] which too would have to be fixed, as recent releases made some serious strides in css and layouting capabilities.

Waqar144 commented 9 months ago

its blocked on https://github.com/litehtml/litehtml/issues/266 atm.

barolo commented 9 months ago

its blocked on litehtml/litehtml#266 atm.

Thanks, managed to compile it with patches provided to qt-review. Very snappy and lightweight, love it. Renders text really nicely too, recently it looked liked shit in webengine for some reason.

image

Waqar144 commented 9 months ago

The patches in Qt have been merged. I have updated the qlitehtml dependency to latest

barolo commented 9 months ago

Probably the best solution would be to have two packages, lite and full with webengine. The reason being that not all docs render properly.

trollixx commented 9 months ago

Very cool! This is something I researched a lot in the past. Unfortunately, too many docsets require JavaScript to render (e.g. all MDN docs). So without regenerating those to not require JS, it'd be impossible to ship this. And given all docsets are coming from Dash, it'd be challenging to also invest in own docsets.

hhartzer commented 8 months ago

This is really cool! I'm curious, is there an issue reported at MDN regarding Javascript rendering to see if they may be open to updating their docs to not require Javascript?

Maybe a stop-gap testing measure for this could be adding a preference to disable Javascript in the rendering to see what happens?