Cleanup selected text as a markdown table
What does this MR do and why?
One problem that can happen when editing markdown tables in the plain text editor is that the pipes of the table get out of line. While this has no effect on it actually being parsed and displayed correctly, editing such a table with more than a few rows and columns can become more difficult. And not even so much editing, but even reading and understanding the table.
This feature allows the customer to select a table in the plain text editor, and use the "Reformat table" in the "More options" menu in the toolbar, to realign the pipes.
For example, taken from https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/issue_templates/AI Model Rollout.md#L32-L36
| Evaluation Pipeline | Model | Quality Metric | P50 Latency | P99 Latency |
|-------------------|-------|----------------|-------------|-------------|
| [pipeline_link] | claude-3-7-sonnet (baseline) | context-qa-accuracy: X | 17.5s | 44s |
| [pipeline_link] | claude-4-0-sonnet | context-qa-accuracy: X | 22s | 40s |
| **Change** | | **XX change** | **+X% slower** | **XX% faster** |
after reformatting would look like this
| Evaluation Pipeline | Model | Quality Metric | P50 Latency | P99 Latency |
|---------------------|------------------------------|------------------------|----------------|----------------|
| [pipeline_link] | claude-3-7-sonnet (baseline) | context-qa-accuracy: X | 17.5s | 44s |
| [pipeline_link] | claude-4-0-sonnet | context-qa-accuracy: X | 22s | 40s |
| **Change** | | **XX change** | **+X% slower** | **XX% faster** |
Even in a template, it's easier to understand what is needed.
In general, the rich text editor does not need this functionality. Editing a table is always in a clean aligned view. It might be interesting to do a reformat when serializing a table from the rich text editor. Today it writes the table in an unaligned way. Reformatting on serialization would keep it looking nice for plain text users as well. But this can be considered in another iteration if desired.
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- Make sure you're using the plain text editor, and then add an unformatted markdown table. You can use the one in the example above.
- Select the text of the table, then choose "Reformat table" in the "More options" dropdown in the editor toolbar.
- Table should be reformatted.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.