6

When you write code out, then you select it and hit the code button (or use the K + Ctrl combo). It doesn't work properly in lists, and "breaks" the typical formatting....

  • I'll start of a random list, then I'll try to use a code block here:

    let theDevelopers = "have a break";

As you can see, it only indents it to the list (probably by-design), and doesn't treat it code block...

There is two ways to solve this:

 - I'll start of a random list, then I'll try to use a code block here:

 <!-- Making a comment, to break the flow -->

    let theDevelopers = "have a break";

Or

- I'll start of a random list, then I'll try to use a code block here:


        let theDevelopers = "have a break";
        // Manually indenting all your code 4 more spaces.

Although these do render differently:

  • I'll start of a random list, then I'll try to use a code block here:
let theDevelopers = "have a break";

and

  • I'll start of a random list, then I'll try to use a code block here:

    let theDevelopers = "have a break";
    // Manually indenting all your code 4 more spaces.
    

My proposal is to replace the current functionality with two separate commands, one that indents, and one that dedents.


The main reason I wanted this to be fixed is because the button that creates the code block toggles, it doesn't append 4 lines every time. So if you truly want to use a code block in a list, you have to indent manually (which can be quite the task, if you're posting a lot of code).


As mentioned in the comments, this is not a duplicate of the question linked.... This is a feature request to make it so the button and CTRL+K work properly in lists, or add separate functions (probably easier) to intended / dedent,

3
  • 2
    @Cerbrus, that's about the formatting itself, I'm talking about how the code button automatically formats it, it toggles, so you will always have to manually indent. That's also why this is a feature-request and not a bug
    – user3117575
    Commented Aug 5, 2015 at 7:42
  • It is not a duplicate. It is a feature-request to be able to indent automatically by a multiple of 4 spaces Commented Aug 5, 2015 at 8:43
  • @Cerbrus How can a feature-request question be a duplicate of a bug one ? Commented Aug 5, 2015 at 15:18

1 Answer 1

1

It would be great to have two different commands one to indent and one to dedent. As a workaround, I generally add a line with a single char (q or .) after the block to indent and select it along with the block. As it now starts on first colum it is indented 4 spaces further. I just have to remove the useless line, or delete the for spaces and iterate if I want more indentation. But it is indeed just a poor man's workaround :-(

1
  • Instead of a single character, add: <!---->
    – Cerbrus
    Commented Aug 5, 2015 at 9:26

You must log in to answer this question.