Remove linebreak inside <a href="">

It's valid, but better safe than sorry.
Don't open the destination file until it's needed

Previously, it was created even if the script failed.
Fix errors with ` and note links

Mysteriously, ` only appeared in conjunction with notes...
Wrap note links in []
Normalize the formatting of the numbered notes
Normalize links to chapter, appendixes, etc

Just link the name, and no bold!
Assert that the use of <b> is under control