These are changes suggested by @darigovresearch so all credit to them.
They were submitted in PR #3115 but that PR has a bunch of whitespace
changes and I am concerned they will have unintended side-effects on
some of the MDX components. So I'm extracting them here.