I've created middleman-pry to replace Middleman's built-in console with a Pry console:

andrew.kvalhe.im$ middleman console

Pry lets you explore the context of your code as you would a filesystem. A simple ls of Middleman is enlightening:

ruby:Middleman::Application$ ls
Middleman::CoreExtensions::Data::InstanceMethods#methods: data
  current_engine   options_for_ext         resolve_template   
  current_engine=  render                  template_extensions
  fetch_layout     render_individual_file  wrap_layout        
  locate_layout    render_template       
  current_page  current_resource  sitemap
  after_build           compass_config      instrument
  after_configuration   configure           logger    
  after_render          development?        ready     
  before                development_config  root      
  before_configuration  full_path           root_path 
  before_render         helpers             source_dir
  build?                initialized         to_s      
  build_config          inspect           
  cache                 instance_available
  blog             blog_instances   current_article   paginate
  blog_controller  blog_month_path  is_blog_article?  tag_path
  blog_day_path    blog_year_path   page_articles   

It's possible to β€œcd” into the context of any objectβ€”for example, this article;

ruby:Middleman::Application$ cd blog.articles.first
ruby:Middleman::Sitemap::Resource$ ls
  add_metadata     blog_controller=   instrument  request_path  url
  app              destination_path   logger      source_file 
  binary?          destination_path=  metadata    store       
  blog_controller  ext                path        template?   
  blog_data     default_summary_generator  previous_article  summary
  blog_options  inspect                    published?        tags   
  body          lang                       render            title  
  date          next_article               slug            

to view relevant documentation as you explore;

ruby:Middleman::Sitemap::Resource$ show-doc slug
From: lib/middleman-blog/blog_article.rb @ line 192:
Owner: Middleman::Blog::BlogArticle
Visibility: public
Signature: slug()
Number of lines: 5

The β€œslug” of the article that shows up in its URL. The article slug
is a parameterized version of the {#title} (lowercase, spaces replaced
with dashes, etc) and can be used in the blog permalink as +:title+.

return [String]

and to execute arbitrary code within the current context:

ruby:Middleman::Sitemap::Resource$ slug
= "use-pry-as-the-middleman-console"