Cool new trick for formatting code in FreewayTalk

If you need to post a code example in FreewayTalk, the current requirement is that you indent each line of your code with a tab or four spaces. This works, but it’s a pain to type, particularly on the Web form.

code
goes
here

PHP Markdown Extra (the fabulous text formatting engine that powers all this madness) updated earlier this year and introduced a new format for code blocks that they’re calling “fenced” blocks. All you do is use an equal number of tildes (~) in a line before and after your code, and everything between will be treated as a <pre><code> block. (If you’re looking at this on the Web, you won’t see the tildes, but there are four of them directly before and after the following text block. Each line of tildes is alone on a single line of text – no other characters in that line.)

No more
Indenting
Needed
    unless
    your
        code
    requires
it

Go Code!

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is a test
     and it’s so easy too
          Thanks Walter

Regards,
Craig


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You’re welcome!

I’m also thinking that this will probably work better from mail than the current scheme, since it’s hard to predict if your mail client will hard-wrap lines, and if so, where exactly.

I usually end up making my lines of text artificially short, so it looks like haiku code.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

haiku code is hard
splitting up the lines like that
Thanks Walter, for fix

freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What is the sound of one hand clapping?

Walter

On Nov 12, 2008, at 4:09 PM, Joe Muscara wrote:

haiku code is hard
splitting up the lines like that
Thanks Walter, for fix

freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Umm… is it just me, or is the code Joe and Craig posted floating off the right hand edge beyond the Gravitar?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Force refresh your browser (Shift-Reload, Option-Reload) because I already saw that and fixed the stylesheet to compensate.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ok, that worked.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options