I use Gollum (https://github.com/gollum/gollum) which is the engine for Github's wikis.
It used to be harder to stand it up for personal use, but now it's quite easy.
I write my notes in Markdown, and have fenced code blocks. It provides search. You can do diffs.