diff --git a/geshifilter.css b/geshifilter.css
index 31571c0..56a6b32 100644
--- a/geshifilter.css
+++ b/geshifilter.css
@@ -61,3 +61,14 @@ div.geshifilter-title {
   margin: 0.5em 0.5em -0.5em 0.5em;
   background-color: #ccc;
 }
+
+/* Styling for GeSHi filter code blocks tools (partial collapsing toggle) */
+div.geshifilter-tools {
+  margin: -0.5em 0.5em 0.5em 0.5em;
+  background-color: #ccc;
+  padding: 0.5ex 0.5em;
+}
+
+div.geshifilter-collapsed {
+  overflow: hidden;
+}
diff --git a/geshifilter.js b/geshifilter.js
index e69de29..0a2cc92 100644
--- a/geshifilter.js
+++ b/geshifilter.js
@@ -0,0 +1,45 @@
+
+// Define a Drupal behavior for with jQuery magic for
+// partial collapsing/showing GeSHi filter code blocks.
+Drupal.behaviors.geshiFilterCodeCollapsing = function (context) {
+  // The height to collapse to.
+  var geshifilter_collapse_height = 100;
+  var geshifilter_collapse_height_threshold = 150;
+
+  // Add the expand/collapse toggle to geshifilter code blocks.
+  $('div.geshifilter.collapsible').each(function() {
+    // Get code container and its height.
+    var code_container = $(this);
+    var code_container_original_height = code_container.height();
+
+    // Only do the collapsing where it makes sense.
+    if (code_container_original_height > geshifilter_collapse_height_threshold) {
+      // Add more/less link.
+      $(this).after('<div class="geshifilter-tools"><a href="#" class="geshifilter-tools-collapsetoggle">' + Drupal.t('Show all code') + '</a></div>');
+      // Store the original heights of the geshifilter divs.
+      code_container.attr('original_height', code_container_original_height);
+      // Collapse by default.
+      code_container.addClass('geshifilter-collapsed').css("height", geshifilter_collapse_height);
+    }
+  });
+
+  // Add handler to read more/collapse link.
+  $("a.geshifilter-tools-collapsetoggle").click(function() {
+    // Get code container.
+    var code_container = $(this).parent().prev();
+
+    if (code_container.hasClass('geshifilter-collapsed')) {
+      // Show more (use original height).
+      var original_height = code_container.attr('original_height') + 'px';
+      code_container.removeClass('geshifilter-collapsed').animate({height: original_height});
+      $(this).text(Drupal.t('Show less code'));
+    }
+    else {
+      // Collapse.
+      code_container.addClass('geshifilter-collapsed').animate({height: geshifilter_collapse_height});
+      $(this).text(Drupal.t('Show all code'));
+    }
+    // Return false so that the link is no followed.
+    return false;
+  });
+}
diff --git a/geshifilter.module b/geshifilter.module
index 5ca3f83..4bada99 100644
--- a/geshifilter.module
+++ b/geshifilter.module
@@ -21,6 +21,7 @@ define('GESHIFILTER_ATTRIBUTE_LINE_NUMBERING', 'linenumbers');
 define('GESHIFILTER_ATTRIBUTE_LINE_NUMBERING_START', 'start');
 define('GESHIFILTER_ATTRIBUTE_FANCY_N', 'fancy');
 define('GESHIFILTER_ATTRIBUTE_TITLE', 'title');
+define('GESHIFILTER_ATTRIBUTE_COLLAPSIBLE', 'collapsible');
 
 define('GESHIFILTER_BRACKETS_ANGLE', 1);
 define('GESHIFILTER_BRACKETS_SQUARE', 2);
@@ -154,6 +155,7 @@ function geshifilter_init() {
     drupal_add_css(file_directory_path() .'/geshifilter-languages.css');
   }
   drupal_add_css(drupal_get_path('module', 'geshifilter') .'/geshifilter.css');
+  drupal_add_js(drupal_get_path('module', 'geshifilter') .'/geshifilter.js');
 }
 
 /**
diff --git a/geshifilter.pages.inc b/geshifilter.pages.inc
index 45d22cd..284e53b 100644
--- a/geshifilter.pages.inc
+++ b/geshifilter.pages.inc
@@ -25,6 +25,7 @@ function _geshifilter_parse_attributes($attributes, $format) {
   $line_numbering = NULL;
   $linenumbers_start = NULL;
   $title = NULL;
+  $collapsible = FALSE;
 
   // Get the possible tags and languages.
   list($generic_code_tags, $language_tags, $tag_to_lang) = _geshifilter_get_tags($format);
@@ -37,7 +38,8 @@ function _geshifilter_parse_attributes($attributes, $format) {
       GESHIFILTER_ATTRIBUTE_LINE_NUMBERING_START,
       GESHIFILTER_ATTRIBUTE_FANCY_N,
       GESHIFILTER_ATTRIBUTE_TITLE,
-    )
+      GESHIFILTER_ATTRIBUTE_COLLAPSIBLE,
+      )
   ));
   $enabled_languages = _geshifilter_get_enabled_languages();
 
@@ -96,9 +98,18 @@ function _geshifilter_parse_attributes($attributes, $format) {
     elseif ($att_name == GESHIFILTER_ATTRIBUTE_TITLE) {
       $title = $att_value;
     }
+    elseif ($att_name == GESHIFILTER_ATTRIBUTE_COLLAPSIBLE) {
+      $collapsible = (strtolower($att_value) === 'true');
+    }
   }
   // Return parsed results.
-  return array('language' => $lang, 'line_numbering' => $line_numbering, 'linenumbers_start' => $linenumbers_start, 'title' => $title);
+  return array(
+    'language' => $lang,
+    'line_numbering' => $line_numbering,
+    'linenumbers_start' => $linenumbers_start,
+    'title' => $title,
+    'collapsible' => $collapsible,
+  );
 }
 
 /**
@@ -279,6 +290,7 @@ function _geshifilter_replace_callback($match, $format) {
   if (isset($settings['title'])) {
     $title = $settings['title'];
   }
+  $collapsible = $settings['collapsible'];
 
   if ($lang == GESHIFILTER_DEFAULT_DONOTHING) {
     // Do nothing, and return the original.
@@ -290,7 +302,7 @@ function _geshifilter_replace_callback($match, $format) {
   }
   $inline_mode = (strpos($source_code, "\n") === FALSE);
   // process and return
-  return geshifilter_process($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode, $title);
+  return geshifilter_process($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode, $title, $collapsible);
 }
 
 /**
@@ -309,21 +321,21 @@ function _geshifilter_override_geshi_defaults(&$geshi, $langcode) {
 /**
  * General geshifilter processing function
  */
-function geshifilter_process($source_code, $lang, $line_numbering=0, $linenumbers_start=1, $inline_mode=FALSE, $title = NULL) {
+function geshifilter_process($source_code, $lang, $line_numbering=0, $linenumbers_start=1, $inline_mode=FALSE, $title = NULL, $collapsible=FALSE) {
   // process
   if ($lang == 'php' && variable_get('geshifilter_use_highlight_string_for_php', FALSE)) {
     return geshifilter_highlight_string_process($source_code, $inline_mode);
   }
   else {
     // process with GeSHi
-    return geshifilter_geshi_process($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode, $title);
+    return geshifilter_geshi_process($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode, $title, $collapsible);
   }
 }
 
 /**
  * geshifilter wrapper for GeSHi processing.
  */
-function geshifilter_geshi_process($source_code, $lang, $line_numbering=0, $linenumbers_start=1, $inline_mode=FALSE, $title = NULL) {
+function geshifilter_geshi_process($source_code, $lang, $line_numbering=0, $linenumbers_start=1, $inline_mode=FALSE, $title = NULL, $collapsible=FALSE) {
   // load GeSHi library (if not already)
   $geshi_library = _geshifilter_check_geshi_library();
   if (!$geshi_library['loaded']) {
@@ -381,7 +393,7 @@ function geshifilter_geshi_process($source_code, $lang, $line_numbering=0, $line
     else {
       $source_code = '';
     }
-    $source_code .= '<div class="geshifilter">'. $geshi->parse_code() .'</div>';
+    $source_code = '<div class="geshifilter'. ($collapsible ? ' collapsible' : '') .'">'. $geshi->parse_code() .'</div>';
   }
 
   // Store in cache with a minimum expiration time of 1 day.
