Resolve "Custom renderers cleanup - erb"
What does this MR do?
It pre-processes a file's source prior to feeding it to the downstream editor, Toast UI currently. This enables us to pre-flag (via codeblock triple-tick syntax) template syntaxes (currently ERB, but this can be extended/abstracted to facilitate other templating syntaxes) such that Toast UI doesn't process the code as content. Without an approach like this, templated code within a file gets interpreted as raw content (paragraphs most commonly) and thus is susceptible to important spacing, indentation, and character escaping information. This pre-processing approach has the side-effect benefit of the templated code to be editable via Toast UI's internal code editor.
There are still exception cases to handle with this approach, but it is much cleaner and less complex than our previous custom renderer approaches. These exceptions will be handled in follow-ups and are:
- ignore when code templates are already in a codeblock or inline code
- account for code template scenarios nested inline of content. Previously we used
render_embedded_ruby_text.js
and we may still use it for these cases however it isn't full proof as Toast UI interprets it as content and is thus susceptible to the aforementioned spacing, indentation, and character escaping degredation.
Screenshots
source | before | after |
---|---|---|
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #232567 (closed)