diff --git a/addon/mode/multiplex.js b/addon/mode/multiplex.js
index 3ff3a929edc4032dd28075105feb16c3f0209f48..32cc579c3ad60d5d4a6a6cd7618820f07a2fb9e3 100644
--- a/addon/mode/multiplex.js
+++ b/addon/mode/multiplex.js
@@ -1,5 +1,5 @@
 CodeMirror.multiplexingMode = function(outer /*, others */) {
-  // Others should be {open, close, mode [, delimStyle]} objects
+  // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects
   var others = Array.prototype.slice.call(arguments, 1);
   var n_others = others.length;
 
@@ -58,6 +58,12 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
         if (found > -1) stream.string = oldContent;
         var cur = stream.current(), found = cur.indexOf(curInner.close);
         if (found > -1) stream.backUp(cur.length - found);
+
+        if (curInner.innerStyle) {
+          if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle;
+          else innerToken = curInner.innerStyle;
+        }
+
         return innerToken;
       }
     },
diff --git a/addon/mode/multiplex_test.js b/addon/mode/multiplex_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c0656357c7273a56f7ff7b59a25e68b2dd7ce156
--- /dev/null
+++ b/addon/mode/multiplex_test.js
@@ -0,0 +1,30 @@
+(function() {
+  CodeMirror.defineMode("markdown_with_stex", function(){
+    var inner = CodeMirror.getMode({}, "stex");
+    var outer = CodeMirror.getMode({}, "markdown");
+
+    var innerOptions = {
+      open: '$',
+      close: '$',
+      mode: inner,
+      delimStyle: 'delim',
+      innerStyle: 'inner'
+    };
+
+    return CodeMirror.multiplexingMode(outer, innerOptions);
+  });
+
+  var mode = CodeMirror.getMode({}, "markdown_with_stex");
+
+  function MT(name) {
+    test.mode(
+      name,
+      mode,
+      Array.prototype.slice.call(arguments, 1),
+      'multiplexing');
+  }
+
+  MT(
+    "stexInsideMarkdown",
+    "[strong **Equation:**] [delim $][inner&tag \\pi][delim $]");
+})();
diff --git a/demo/multiplex.html b/demo/multiplex.html
index 9ebe8f357b9555f1aad8faa8cc0374d144cfd338..ec0519cb98a9ebe185e9f5618582bdd90abe1c3f 100644
--- a/demo/multiplex.html
+++ b/demo/multiplex.html
@@ -56,5 +56,11 @@ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
     the <a href="../addon/mode/multiplex.js">source</a> for more
     information.</p>
 
+    <p>
+      <strong>Parsing/Highlighting Tests:</strong>
+      <a href="../test/index.html#multiplexing_*">normal</a>,
+      <a href="../test/index.html#verbose,multiplexing_*">verbose</a>.
+    </p>
+
   </body>
 </html>
diff --git a/doc/manual.html b/doc/manual.html
index a7d6a67948511feb4686476bfc2740648db34216..5d029aebc1a0612a66462d91dd4fce4f601a7fbb 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -788,7 +788,7 @@
       <dt id="lastLine"><code><strong>doc.lastLine</strong>() → integer</code></dt>
       <dd>Get the last line of the editor. This will
       usually be <code>doc.lineCount() - 1</code>,
-      but for <a href="#linkedDoc_from">linked sub-views</a>, 
+      but for <a href="#linkedDoc_from">linked sub-views</a>,
       it might return other values.</dd>
 
       <dt id="getLineHandle"><code><strong>doc.getLineHandle</strong>(num: integer) → LineHandle</code></dt>
@@ -1150,7 +1150,7 @@
     </dl>
 
     <h3 id="api_decoration">Widget, gutter, and decoration methods</h3>
-    
+
     <dl>
       <dt id="setGutterMarker"><code><strong>cm.setGutterMarker</strong>(line: integer|LineHandle, gutterID: string, value: Element) → LineHandle</code></dt>
       <dd>Sets the gutter marker for the given gutter (identified by
@@ -1160,7 +1160,7 @@
       clear the marker, or a DOM element, to set it. The DOM element
       will be shown in the specified gutter next to the specified
       line.</dd>
-      
+
       <dt id="clearGutter"><code><strong>cm.clearGutter</strong>(gutterID: string)</code></dt>
       <dd>Remove all gutter markers in
       the <a href="#option_gutters">gutter</a> with the given ID.</dd>
@@ -1643,7 +1643,7 @@
       between several modes.
       Defines <code>CodeMirror.multiplexingMode</code> which, when
       given as first argument a mode object, and as other arguments
-      any number of <code>{open, close, mode [, delimStyle]}</code>
+      any number of <code>{open, close, mode [, delimStyle, innerStyle]}</code>
       objects, will return a mode object that starts parsing using the
       mode passed as first argument, but will switch to another mode
       as soon as it encounters a string that occurs in one of
@@ -1652,9 +1652,11 @@
       the <code>close</code> string is encountered.
       Pass <code>"\n"</code> for <code>open</code> or <code>close</code>
       if you want to switch on a blank line.
-      When <code>delimStyle</code> is specified, it will be the token
-      style returned for the delimiter tokens. The outer mode will not
-      see the content between the delimiters.
+      <ul><li>When <code>delimStyle</code> is specified, it will be the token
+      style returned for the delimiter tokens.</li>
+      <li>When <code>innerStyle</code> is specified, it will be the token
+      style added for each inner mode token.</li></ul>
+      The outer mode will not see the content between the delimiters.
       See <a href="../demo/multiplex.html">this demo</a> for an
       example.</dd>
 
@@ -1699,7 +1701,7 @@
 
       <dt id="addon_active-line"><a href="../addon/selection/active-line.js"><code>selection/active-line.js</code></a></dt>
       <dd>Defines a <code>styleActiveLine</code> option that, when enabled,
-      gives the wrapper of the active line the class <code>CodeMirror-activeline</code>, 
+      gives the wrapper of the active line the class <code>CodeMirror-activeline</code>,
       and adds a background with the class <code>CodeMirror-activeline-background</code>.
       is enabled. See the <a href="../demo/activeline.html">demo</a>.</dd>
 
diff --git a/test/index.html b/test/index.html
index 3eb691576ad3871855823c723568227594206b38..4667d589e8e8fa147a4e8f00efe74dcc89ff5b9e 100644
--- a/test/index.html
+++ b/test/index.html
@@ -8,6 +8,7 @@
     <link rel="stylesheet" href="mode_test.css">
     <script src="../lib/codemirror.js"></script>
     <script src="../addon/mode/overlay.js"></script>
+    <script src="../addon/mode/multiplex.js"></script>
     <script src="../addon/search/searchcursor.js"></script>
     <script src="../addon/dialog/dialog.js"></script>
     <script src="../addon/comment/comment.js"></script>
@@ -73,6 +74,7 @@
     <script src="../mode/stex/test.js"></script>
     <script src="../mode/xquery/xquery.js"></script>
     <script src="../mode/xquery/test.js"></script>
+    <script src="../addon/mode/multiplex_test.js"></script>
     <script src="vim_test.js"></script>
     <script>
       window.onload = runHarness;