I sync Obsidian with Git and use pandoc for book / ebook generation (or Foam with Visual Code might work too).
Scrivener can synchronise with Git too - albeit indirectly (it sync's with a folder & I use a simple script to keep it up to date)
If you need to organise research you can sync Wiki.js with Git.
However, Gitbook or mdBook might be easier to use for a single book project.
https://www.gitbook.com/
https://rust-lang.github.io/mdBook/
https://foambubble.github.io/foam/
https://js.wiki/
https://obsidian.md/