Skip to content

Add the ability to disable math rendering limits

What does this MR do and why?

There are various limits when rendering math equations - they can be time and resource intensive, and too many can cause huge delays in rendering a page.

While these limits are necessary on the Saas offering, those who run their own instance and use math extensively can be hampered by these limits.

  • issues/MRs/wiki/repos: RENDER_NODES_LIMIT on the backend limits the number of nodes rendered in a markdown block to 50
  • issues/MRs/wiki/repos: MAX_MACRO_EXPANSIONS on the frontend limits the number of macro expansions to 1000
  • issues/MRs/wiki/repos: MAX_USER_SPECIFIED_EMS on the frontend limits user-specified sizes to 20ems
  • issues/MRs: MAX_MATH_CHARS on the frontend limits the number of characters in a math block to 1000
  • issues/MRs: MAX_RENDER_TIME_MS on the frontend limits the amount of time it takes to render to 2000ms

How to set up and validate locally

  1. open a Rails console and check that ApplicationSetting.first.math_rendering_limits_enabled? returns true

  2. go to an issue and add the following in a comment box

    $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$
    $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$
    $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$
    $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$
    $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$ + $`a^2+b^2=c^2`$
  3. use Preview and verify that only a portion of the formulas are displayed as rendered math

  4. go back to the Rails console and do a ApplicationSetting.update(math_rendering_limits_enabled: false)

  5. back on the comment box, you should be able to Preview again and all the formulas will be displayed as rendered math

  6. Note: it may require you to reload the page once or twice to ensure the update application settings are propagated

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #214530 (closed)

Edited by Brett Walker

Merge request reports