Permalink
Browse files

Fix for extension flags

  • Loading branch information...
lhagan committed May 19, 2012
1 parent 411d8ae commit 66753872188ae84b198d58d35615ce9706adfe93
Showing with 20 additions and 2 deletions.
  1. +13 −2 README.mkd
  2. +7 −0 index.js
View
@@ -43,7 +43,7 @@ Then, call the `markdown` function passing as arguments your renderer,
the markdown code to parse, and a callback to handle the result:
```javascript
-var rs = require('robotskirt');
+var rs = require('robotskirt')
, sys = require('sys');
var renderer = new rs.HtmlRenderer();
@@ -73,12 +73,23 @@ fs.readFile('README.mkd', function (err, data) {
You can pass some flags to Sundown by passing them as an (optional) last argument:
```javascript
-var flags = rs.EXT_FENCED_CODE & rs.EXT_AUTOLINK;
+var rs = require('robotskirt')
+ , sys = require('sys');
+
+var renderer = new rs.HtmlRenderer()
+ , flags = rs.flags.EXT_FENCED_CODE + rs.flags.EXT_AUTOLINK;
+
rs.markdown(renderer, 'Wow, this becomes http://autolink.ed !', function (html) {
sys.puts(html);
}, flags);
```
+Or, to enable all supported flags, use:
+
+```javascript
+var flags = ~0;
+```
+
### Being synchronous...
If you would like to parse your markdown synchronously you can use the `markdownSync` function:
View
@@ -4,6 +4,13 @@ var Robotskirt = {
HtmlRenderer: rs.HtmlRenderer,
markdownSync: rs.markdownSync,
markdown: rs.markdown,
+ flags: { EXT_AUTOLINK: rs.EXT_AUTOLINK,
+ EXT_FENCED_CODE: rs.EXT_FENCED_CODE,
+ EXT_LAX_HTML_BLOCKS: rs.EXT_LAX_HTML_BLOCKS,
+ EXT_NO_INTRA_EMPHASIS: rs.EXT_NO_INTRA_EMPHASIS,
+ EXT_SPACE_HEADERS: rs.EXT_SPACE_HEADERS,
+ EXT_STRIKETHROUGH: rs.EXT_STRIKETHROUGH,
+ EXT_TABLES: rs.EXT_TABLES },
toHtml: function (markdownText, callback) {
this.markdown(new this.HtmlRenderer(), markdownText, callback);

0 comments on commit 6675387

Please sign in to comment.