In sx.el compose mode, what is the correct way to mark some region as a code block, the way C-k does it on the web interface ?

1 Answer 1


If you select a region and run the command markdown-insert-pre (C-c C-s p for me), it will mark the selected region as preformatted text. I am not sure if there is any difference, but for me it seems to indent the region as a code block. You can also start a code block this way if there is no active region.

Also, C-c C-s c will wrap selection in backticks or give you a pair of backticks with the cursor in the middle so you can write a code snippet

  • Thanks. I'd been looking through sx- commands instead of markdown-.
    – wilk
    Jan 5, 2016 at 15:32
  • Yeah, it is kind of hidden and the name does not make any reference to "code" or "block", so it is not clear by looking through command names. I actually stumbled upon it by looking through the menu for sx-compose-mode. I almost never use the menus, but this is one thing that they are handy for.
    – elethan
    Jan 5, 2016 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.