Anytype. Local-first, p2p sync with e2ee. It uses the notion model (everything is an object, you can create "databases" with queries of objects). It doesn't store markdown directly I believe, but it can export into markdown perfectly.
I recently moved to anytype from logseq as it hit for me all the right notes for personal stuff, shared family stuff and work stuff.
I wanted something like notion but faster and most importantly, private.
The workspace data is encrypted with a (symmetric) workspace key. Each user gets hteir own encrypted copy of that key, using the user's public key. By wrapping the data-encryption key for each user the content is only encrypted once but each authorized user can decrypt it.
Ah ok. I guess that means when a user leaves the team, you have to re-encrypt the codebase with a new symetric key (as the user would still know the old symetric key)?