Conditional comment (with optional custom tag) ref are extracted

Rewrite of #4 to also include custom tags and implicit optionality of the comment