diff --git a/src/Lexer.js b/src/Lexer.js
index 31a9d4695be692889920343ac62a773d25969eff..15525b07532c94671b0d0cbd49a87bf57952a9e2 100644
--- a/src/Lexer.js
+++ b/src/Lexer.js
@@ -63,16 +63,32 @@ var atomRegex = {
     open: /^\{/,
     close: /^\}/,
     ordinary: /^[^\\{}$&#%_\s]+/,
-    math: mathPattern ///^\$.*\$/
+    math: mathPattern ///^\$.*\$/,
 };
-var whitespaceRegex = /^\s*/;
+var commentRegex = /^%.*/
+var whitespaceRegex = /^\s+/;
+
+Lexer.prototype._skip = function(len) {
+    this._pos += len;
+    this._remain = this._remain.slice(len);
+}
 
 /* Get the next atom */
 Lexer.prototype._next = function() {
-    // Skip whitespace (zero or more)
-    var whitespaceLen = whitespaceRegex.exec(this._remain)[0].length;
-    this._pos += whitespaceLen;
-    this._remain = this._remain.slice(whitespaceLen);
+    while (1) {
+        // Skip whitespace (one or more)
+        var whitespaceMatch = whitespaceRegex.exec(this._remain);
+        if (whitespaceMatch) {
+            var whitespaceLen = whitespaceMatch[0].length;
+            this._skip(whitespaceLen);
+        }
+
+        // Skip comment
+        var commentMatch = commentRegex.exec(this._remain);
+        if (!commentMatch) break;
+        var commentLen = commentMatch[0].length;
+        this._skip(commentLen);
+    }
 
     // Remember the current atom
     this._currentAtom = this._nextAtom;
diff --git a/static/test-suite.html b/static/test-suite.html
index 109342baca48a2242132e8cc1047bb2a6711e12e..57bc8be214e84f2dd36f4ceeb1768865ef72d46a 100644
--- a/static/test-suite.html
+++ b/static/test-suite.html
@@ -104,8 +104,9 @@
         \end{algorithmic}
         \end{algorithm}
     </pre>
-    <!-- Chapter 7, Introduction to Algorithms (3rd edition)-->
     <pre id="test-examples" style="display:none">
+        % This quicksort algorithm is extracted from Chapter 7, Introduction 
+        % to Algorithms (3rd edition)
         \begin{algorithm}
         \caption{Quicksort}
         \begin{algorithmic}