I do this stuff with my notes in Emacs and it's really nice. Emacs is a graphical application and its notetaking facilities are really outstanding. It even supports syntax highlighted, executable, exportable code snippets, as well as all the basic text formatting, hyperlinks, tables of contents, tables, etc. It's a great tool for developers and sysadmins to use for notetaking.
If you know Emacs isn't for you, that's totally fine, but I wanted to throw this out there for bystanders that when someone suggests to build your notetaking workflow around a great text editor, the proposition is not at all to somehow confine oneself to an 1980s terminal.