I wonder if you know TiddlyWiki?
https://tiddlywiki.com
I've been using it for music text books, note books etc...
It is searchable and downloadable as a single file. It can save changes from a browser and be used/edited locally on a pc or online via a plethora of backends or simply with a small php script.
Here are a couple of examples I made myself:  TW classic: https://xn--mns-ula.dk/sky/apps/files_sharing/get.php?token=45ea57138089eeb535e36cee53b8831076041bf5 
The new TW: https://bopland-tw5.tiddlyspot.com/

Cheers M&aring;ns M&aring;rtensson, Denmark