# Testing fenced code blocks markdown=yes I'm typing this page in Markdown. #junco - #testing - #markup Will try to add my own support for this. Will make it available, regardless of what markup language that I'm using, similar to my other custom formatting commands. My custom fenced code block command `code. / code..` is available when I'm typing in Textile or Markdown/Multimarkdown. The feature limits the window size that displays the code. So if it's a large blob of code, a small read-only text window with vertical and horizontal scrollbars displays the code. A fence-code block like what's used by the Github Flavored Markdown or specified at [CommonMark](http://jgm.github.io/stmd/spec.html#fenced-code-blocks) would display the entire code blob on the web page. But instead of indenting the entire code blob four spaces on each line like with Markdown, the fenced block only needs to be surrounded by three tildes or three backticks. I also support a command called `code=yes` but this turns the entire web page into a code page. Sometimes, that's fine, but most of the time, code text is mixed with normal text on the same web page. Using my `code. / code..` command to display [my Perl module](https://github.com/jrsawvel/Yo-Perl/blob/master/lib/Yo.pm) that uses the Yo API. code.package Yo; use strict; use warnings; use LWP::UserAgent; my %URLS = ( 'all' => 'http://api.justyo.co/yoall/', 'user' => 'http://api.justyo.co/yo/', 'subscribers' => 'http://api.justyo.co/subscribers_count/' ); sub new { my ($class, $api_token) = @_; my $self = (); $self->{api_token} = $api_token; $self->{link} = undef; bless($self, $class); return $self; } sub set_link { my ($self, $link) = @_; $self->{link} = $link; } sub all { my ($self) = @_; my $ua = LWP::UserAgent->new(); my $response; if ( defined($self->{link}) ) { $response = $ua->post( $URLS{'all'}, { 'api_token' => $self->{api_token}, 'link' => $self->{link} } ); } else { $response = $ua->post( $URLS{'all'}, { 'api_token' => $self->{api_token} } ); } my $rc = $response->code; return $rc; } sub user { my ($self, $username) = @_; my $ua = LWP::UserAgent->new(); my $response; if ( defined($self->{link}) ) { $response = $ua->post( $URLS{'user'}, { 'api_token' => $self->{api_token}, 'username' => $username, 'link' => $self->{link} } ); } else { $response = $ua->post( $URLS{'user'}, { 'api_token' => $self->{api_token}, 'username' => $username } ); } my $rc = $response->code; return $rc; } sub subscribers { my ($self) = @_; my $ua = LWP::UserAgent->new(); my $url = $URLS{'subscribers'} . "?api_token=" . $self->{api_token}; my $response = $ua->get($url); my $content = $response->decoded_content(); return $content; # return json. example {"result": 123}. let client decode json. } sub DESTROY { my ($self) = @_; $self->{api_token} = undef; $self->{link} = undef; } 1; code.. With Markdown, I could indent the code four spaces on each line, but that's time consuming for a decently-sized block of code. Here's a snippet of the above code with each line indented four spaces: use strict; use warnings; use LWP::UserAgent; my %URLS = ( 'all' => 'http://api.justyo.co/yoall/', 'user' => 'http://api.justyo.co/yo/', 'subscribers' => 'http://api.justyo.co/subscribers_count/' ); sub new { my ($class, $api_token) = @_; my $self = (); $self->{api_token} = $api_token; $self->{link} = undef; bless($self, $class); return $self; }