if invisible tags like ~~NOCACHE~~ or ~~NOTOC~~ are used on top of the page, where they should be, but are listed with a \n, this creates a empty line before of the first Title.
~~NOCACHE~~
~~NOTOC~~
====== Title ======
or
!
~~NOCACHE~~ ~~NOTOC~~====== Title ======
therefore the first following empty char should be ignored, by all invisible tags.
~~NOCACHE~~\s?
i checked the patch and had no problems, but check it first too, to be sure there are no unwanted side effects.