Skip to content

Fix code block language related issues

Himanshu Kapoor requested to merge 350364-code-block-language into master

What does this MR do and why?

Code blocks with undefined/unknown language get labeled plaintext after saving in Content Editor. This commit fixes the issue.

Related to #350364 (closed) and #358393 (closed)

Screenshots or screen recordings

Before After
Screen_Recording_2022-06-14_at_11.39.20_AM Screen_Recording_2022-06-14_at_11.38.54_AM

How to set up and validate locally

  1. Create a new wiki page or edit an existing one.

  2. Enter the following code:

    ```
      plaintext
    ```
    
    ```foobar
      custom_language = >> this <<
    ```

    Notice that the first block doesn't have a language defined and the second one has a custom language (foobar) defined.

  3. Click "Edit rich text" to switch to content editor.

  4. Click "Edit source" to switch back to the markdown editor.

  5. The code should look exactly the same as what you started with.

MR acceptance checklist

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

Edited by Himanshu Kapoor

Merge request reports