They’ve already done it ;)
Maybe you should try Anytype. It’s Open Source, encrypted, has applications for major OSes, provides synchronization, allows export of documents to Markdown and PDF. Sometimes it’s rough on the edges, but I think it has a potential.
This reminds me of a movie from the 90s titled Mind ripper