Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix markdown

  • Loading branch information...
commit 5787d8874ca0aa68576297b44e8defffa6ea3d9b 1 parent 1551ca5
Florent Jaby authored April 14, 2011

Showing 1 changed file with 14 additions and 13 deletions. Show diff stats Hide diff stats

  1. 27  README.md
27  README.md
Source Rendered
@@ -7,29 +7,30 @@ node-tokenizer is published on npm so you can install it with
7 7
 
8 8
 ## How to
9 9
 * require the Tokenizer constructor
10  
-        var Tokenizer = require('tokenizer');
  10
+            var Tokenizer = require('tokenizer');
11 11
 * construct one (we'll see what the callback is used for)
12  
-        var t = new Tokenizer(mycallback);
  12
+            var t = new Tokenizer(mycallback);
13 13
 * add rules
14  
-        t.addRule(/^my regex$/, 'type');
  14
+            t.addRule(/^my regex$/, 'type');
15 15
 * write or pump to it
16  
-        t.write(data);
17  
-        // or
18  
-        stream.pipe(t);
  16
+            t.write(data);
  17
+            // or
  18
+            stream.pipe(t);
19 19
 * listen for new tokens
20  
-        t.on('token', function(token, type) {
21  
-            // do something useful
22  
-            // type is the type of the token (specified with addRule)
23  
-            // token is the actual matching string
24  
-        })
25  
-        // alternatively you can listen on the 'data' event
  20
+            t.on('token', function(token, type) {
  21
+                // do something useful
  22
+                // type is the type of the token (specified with addRule)
  23
+                // token is the actual matching string
  24
+            })
  25
+            // alternatively you can listen on the 'data' event
26 26
 * look out for the end
27  
-        t.on('end', callback);
  27
+            t.on('end', callback);
28 28
 
29 29
 the optional callback argument for the constructor is a function that will
30 30
 be called for each token in order to specify a different type by returning
31 31
 a string. The parameters passed to the function are token(the token that we found)
32 32
 and match, an object like this 
  33
+
33 34
     {
34 35
         regex: /whatever/ // the regex that matched the token
35 36
         type: 'type' // the type of the token

0 notes on commit 5787d88

Please sign in to comment.
Something went wrong with that request. Please try again.