TiddlyWiki (
https://tiddlywiki.com/) is a great place to start - It's a hypertext notebook contained in a single html/js file. It's really one of the best and most underappreciated/underutilized open source projects out there, and it's been out there for about 20 years now!
Depending what all you want, it may or may not do everything you need - but it can almost certainly be extended to do a great deal (there are custom versions for a variety of applicaitons, including blogging, academia, writing/researching, etc.)
Seriously, TW is one of my favorite little-known projects. (Back around 2003-4, at my first startup of my own, I used TW to prototype a lab notebook I jokingly called a "testacle" that encapsulated test setups, code, and other documentation (images, tables, text, etc.), as well as the actual collected data and metadata (units, etc.) collected from the world's first embedded web-enabled IoT sensors. Having everything for each test in a single file was intended to make it much easier to archive results and retrace steps and reproduce tests if needed in the future.)
Some of this isn't as easy as you (or I) would like, but the nice thing is that anything you can do in JS, you can conceivably do in TW. It's worth a look.