Skip to content

Content Editor: Support tables in client-side Markdown parser

Enrique Alcántara requested to merge 359015-preserve-tables-content-editor into master

What does this MR do and why?

  • NOTICE: This change is behind a the preserve_unchanged_markdown feature flag.
  • Context: This change is part of a larger effort to preserve unchanged Markdown in the Content Editor. For this effort, we need to support client-side parsing of Markdown content.

This MR implements support for GFM tables in the client-side Markdown parser/renderer for the Content Editor. It also preserves the original table source when the user doesn’t change the table in the Content Editor.

Screenshots or screen recordings

If a table hasn’t changed, the original table syntax is preserved. If the table was defined using HTML, the table will stay as HTML when switching back to source mode or saving changes.

2022-05-25_14.57.33

How to set up and validate locally

  • Enable the preserve_unchanged_markdown feature flag.

  • Edit or create a Wiki page in your local environment.

  • Add the following tables in the Classic Markdown Editor

    | header | header |
    | ------ | ------ |
    | cell | cell |
    | cell | cell |
    
    <table>
     <tr>
      <th>Header</th>
     </tr>
    </table>
  • Switch to rich text mode

  • Add a paragraph below the tables

  • If you switch to Source mode again, you will notice the new paragraph and the original tables are preserved.

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

Edited by Enrique Alcántara

Merge request reports