There is no need for a self-hosted option. You could use Obsidian or LogSeq, they have a host of features including Markdown support. They support Android, iPhone/Mac, Linux, and Windows. Both offer cloud options that are encrypted. However both app's cloud features are behind a paywall, and LogSeq's is currently in alpha.