Content Editor: Support pre tags used for other purposes than defining code blocks in client-side parser
What does this MR do and why?
This MR adds support for declaring pre
tags outside of their common usage in code blocks. When a Markdown renderer converts Markdown into HTML, code blocks usually look like this:
<pre lang="javascript">
<code>
Code
</code>
</pre>
There are cases where you may find the pre
tag used outside this use case. The example 118 of the GFM spec demonstrates it: https://github.github.com/gfm/#example-118
This MR adds support for pre
tags by telling the client-side Markdown renderer to skip rendering of code blocks and preserve the original Code Block node coming from the Markdown AST. This allows us to have two separate converters in the Hast to ProseMirror converter: One for pre
tags and another for code blocks
.
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- Enable the
preserve_unchanged_markdown
feature flag. - Edit or create a Wiki page
- Paste the following snippets in the Classic Markdown Editor:
<table><tr><td> <pre> **Hello**, _world_. </pre> </td></tr></table>
- Switch to the Content Editor. The Content Editor should display this Markdown snippet.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #365292 (closed)