Skip to content

Display slash commands outcome when previewing Markdown

username-removed-378947 requested to merge adam-separate-slash-commands into master

What does this MR do?

This continues the work started in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7497.

  • Remove slash commands from Markdown preview and display their outcome next to the text field.
  • Introduce new "explanation" block to our slash commands DSL.
  • Introduce optional "parse_params" block to slash commands DSL that allows to process a parameter before it is passed to "explanation" or "command" blocks.
  • Pass path for previewing Markdown as "data" attribute instead of setting a variable on "window".

Are there points in the code the reviewer needs to double check?

I didn't use shared_examples for testing InterpretService#explain, because I don't think that testing the same stuff for Issue and MergeRequest makes sense. Instead I'm testing Issue in roughly half of the specs and MergeRequest in the rest.

Why was this MR needed?

We don't display slash commands after issue / merge requests / comment is submitted. Hence, we should also remove them from Markdown preview. Having their outcome displayed as well is helpful.

Screenshots (if relevant)

preview-slash-commands

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #21531 (closed)

EE MR https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1707

Merge request reports