5

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 ?

wilk
  • 519
  • 2
  • 11

1 Answers1

4

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

elethan
  • 4,755
  • 3
  • 29
  • 56
  • Thanks. I'd been looking through sx- commands instead of markdown-. – wilk Jan 05 '16 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 05 '16 at 15:34