Don't render TOC in emailed note notifications
What does this MR do and why?
Fixes TOC (Table of Contents) tags should not be rend... (#581849).
Note email templates re-render Markdown from scratch using
EmailPipeline, which (unlike NotePipeline) doesn't set
no_header_anchors. This caused [[_TOC_]]-style tags to be rendered
in the email notification, even though the note itself wouldn't expand
them.
Fix by passing no_header_anchors: true in the note email partial. We
don't want to modify EmailPipeline itself since it does actually need to
render TOCs sometimes (e.g. for issue/MR descriptions in notifs).
How to set up and validate locally
- Check out the branch.
- Create a note on an issue or MR that looks like this:
You should
[[_TOC_]] # Hello, world! ## Olá, mundo! @someuser@mentiona user who isn't the one you're logged in as, to trigger an email notification. - Visit
/rails/letter_opener. You should see something like this:

Why is it blocked? I dunno, our Letter Opener configuration seems to be a bit wonky. You can middle-click the email at left to open it in a new tab. It should look like this:

Note it says_TOC_as a link. This is correct — it matches the actual render on the site:

An incorrect result would be an actual table of contents appearing in the email notif, which is the current behaviour.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Asherah Connor


