Skip to content

[markdown] maintain cursor indentation position when pressing return/enter

Implementation Guide

When pressing return/enter, would should try to keep the cursor at the same indentation level as previous text lines. This makes it much easier to write multiple paragraphs inside a list or sublists - the text will start out indented to the correct level.

This will most likely need to be added into https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/javascripts/lib/utils/text_markdown.js#L613-L620, with test added to https://gitlab.com/gitlab-org/gitlab/blob/master/spec/frontend/lib/utils/text_markdown_spec.js

We may need to add a user preference for this behavior, like we do for Surround text selection when typing quotes or brackets, though I think it would be sufficient to initially add a feature flag as we did in !79161 (diffs), then we can determine the best way to expose it.


Original description

When in a code block in GFM, auto indent when you hit return/enter.

A code block would be if you have the three ticks at the beginning and the end.

Edited by Brett Walker