Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.947
diff -u -p -r1.947 node.module
--- modules/node/node.module	3 Feb 2008 19:41:47 -0000	1.947
+++ modules/node/node.module	14 Feb 2008 03:45:30 -0000
@@ -335,6 +335,21 @@ function node_teaser($body, $format = NU
   // If the delimiter has not been specified, try to split at paragraph or
   // sentence boundaries.
 
+  // Determine the text length of markup in the text.
+  // preg_split ensures that $chunks consists of alternating literals and
+  // delimiters, and begins and ends with a literal chunk (inserting empty array
+  // items as required).
+  $chunks = preg_split('@(<(?:[a-zA-Z/][^>]*|!--.*?--)>)@', $body, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE);
+  $text_length = 0;
+  for ($i = 0; $i <= count($chunks); $i += 2) {
+    $text_length += drupal_strlen($chunks[$i][0]);
+    if ($text_length > $size) {
+      break;
+    }
+  }
+  // Add the length of all markup to the maximum length specified.
+  $size += $chunks[$i][1];
+
   // The teaser may not be longer than maximum length specified. Initial slice.
   $teaser = truncate_utf8($body, $size);
 
