News for hackers. Stuff that matters.
Re:Reasons to Learn Markdown by zht on Wednesday April 18, 2012 @09:01PM (#3860946)
I dislike the fact that in order insert a code block I have to smash my space bar 4 times for each line.
Re:Reasons to Learn Markdown by read_wharf on Wednesday April 18, 2012 @09:19PM (#3860993)
Then don't do that.

Edit your code block over at the left margin as you would normally edit any code. Then do a block insert of 4 spaces down the left side of your code block. That's how I do it.

    line of code
    line of code
        indented line of code
    line of code
In vim, after editing your code like you usually would:

    Go to the front of the top line,
    Ctrl-V to enter visual block mode (Ctrl-Q on windows),
    jjj to the bottom line,
    I (capital I) to insert at the front,
    space space space space,
    escape.
I did exactly that to create the above two blocks.
Re:Reasons to Learn Markdown by pge on Wednesday April 18, 2012 @09:28PM (#3861018)
in vim, you can also use ">>" command which indents a line. if you use python, your vim is probably already set up to indent four spaces, so the above can be done with "4>>" (=indent next four lines)
Re:Reasons to Learn Markdown by zecho on Wednesday April 18, 2012 @10:57PM (#3861199)
One of the few times I find myself in visual mode is when I'm indenting lines. v{motion}>> or <<. Super useful.
Re:Reasons to Learn Markdown by libria on Thursday April 19, 2012 @12:24AM (#3861388)
Or

    Capital V
    jjjjj
    >
Or

    6>>
Re:Reasons to Learn Markdown by kylebragger on Wednesday April 18, 2012 @09:19PM (#3860995)
Off the top of my head I'm not sure if this is part of Markdown proper (or maybe GitHub's "flavor") but you can do fenced code blocks, like so:

~~~

// your code // goes here // and here

~~~

Re:Reasons to Learn Markdown by AncientPC on Wednesday April 18, 2012 @10:32PM (#3861145)
That's GitHub flavor. You can also use back ticks and specify syntax highlighting, e.g:

    ```python

    from functools import partial

    def foo(a,b,i):
        if i >= a and i <= b:
            return i**2
        else:
            return 0

    print reduce(lambda x,y: x+y,map(partial(foo,3,7),xrange(1,10)))
    ```
Re:Reasons to Learn Markdown by rkudeshi on Wednesday April 18, 2012 @09:08PM (#3860969)
You can also just press tab.
Re:Reasons to Learn Markdown by zht on Wednesday April 18, 2012 @09:14PM (#3860982)
That doesn't work well in browsers (especially for blogs)
Re:Reasons to Learn Markdown by rkudeshi on Wednesday April 18, 2012 @09:57PM (#3861061)
True. I usually write in an app first (either nvALT or Byword) and then copy and paste online.