I am not sure if this is the case here, but it is possible that a section mismatch will be undetected and allow the option to edit if the text is modified by another add-on while using the parser to search for the headings (only H, and plaintext-related BB-Codes are active) which does not use a BB-Code to modify the output.
In such a case, or effectively for any case that is not already handled, we should validate a section before loading the editor (or submitting an edit), by ensuring the following:
- the section starts with appropriate H tag syntax
- the section ends immediately before the next appropriate H tag syntax or the content's end
If both conditions are not true then a section mismatch error should be thrown. It may not be possible to prevent all mismatches from offering an edit link, especially if they are caused by a parser-based add-on.