Fix crashes and rendering issues with certain Markdown code blocks.

Review Request #13129 — Created June 28, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

When adding code blocks with certain bits of text (such as a leading
shebang, Python-Markdown) can go into "line number mode", where it tries
to render the code blocks with line numbers on the side. A shebang seems
to trigger this behavior. When in this mode, some assumptions we make
for Markdown diffing fail, leading to a crash.

This change forces line numbers to be off, so that we're never in this
state. Now, all code blocks behave exactly the same way.

While testing this, I noticed that our rendering of changed code blocks
for change description entries was incorrect. Code blocks were shifted
and text was obscured with a background color. At some point, we may
need to completely rethink the CSS around all of this, but for now, new
styles have been written to make these flush with the container, fade
out the background, and include top/bottom borders around the code
block (which used to exist a few major versions ago).

Tested with some code samples that formerly caused crashes.

Unit tests pass.

Diffed several Markdown code blocks and saw that the results were
legible.

Summary ID
Fix crashes and rendering issues with certain Markdown code blocks.
When adding code blocks with certain bits of text (such as a leading shebang, Python-Markdown) can go into "line number mode", where it tries to render the code blocks with line numbers on the side. A shebang seems to trigger this behavior. When in this mode, some assumptions we make for Markdown diffing fail, leading to a crash. This change forces line numbers to be off, so that we're never in this state. Now, all code blocks behave exactly the same way. While testing this, I noticed that our rendering of changed code blocks for change description entries was incorrect. Code blocks were shifted and text was obscured with a background color. At some point, we may need to completely rethink the CSS around all of this, but for now, new styles have been written to make these flush with the container, fade out the background, and include top/bottom borders around the code block (which used to exist a few major versions ago).
c642891a615a87e3edb95adb85e233ff2f05a8f5

maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (d3c9ec6)