Preserve bold, italic, code, and link syntax in the Content Editor

What does this MR do and why?

It implements a mechanism that allows the Content Editor to remember the original syntax used to format bold, italic, code, and links.

Context

In Markdown, you can apply the same text format using different approaches, i.e. you can apply bold format in 4 ways:

**bold text** and __bold text__ and <b>bold text</b> and <strong>bold text</strong> 

Currently, when the user saves changes in the Content Editor, the Content Editor will transform all bold text to the same syntax: **. After this change, the Content Editor will remember the syntax preferred by the user.

Screenshots or screen recordings

Before After
2022-05-10_17.57.20 2022-05-10_17.56.25

How to set up and validate locally

  1. Enable preserve_unchanged_markdown feature flag.
  2. Edit a Wiki page.
  3. In the Classic Markdown Editor, enter the following Markdown snippet:
       **bold text** and __bold text__ and <b>bold text</b> and <strong>bold text</strong> 
  4. Switch to the Rich text mode, and edit this text.
  5. Switch back to source mode. All the bold syntax should be preserved. You can try the same with links, code, and italic format.

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 #359019 (closed)

Edited by Enrique Alcántara

Merge request reports

Loading