├── .gitignore ├── .gitmodules ├── .npmignore ├── History.md ├── Readme.md ├── examples ├── example.md ├── flags.js └── run.js ├── package.json ├── src └── markdown.cc └── wscript /.gitignore: -------------------------------------------------------------------------------- 1 | src/*.o 2 | build 3 | .lock-wscript -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/discount"] 2 | path = deps/discount 3 | url = git://github.com/Orc/discount.git 4 | [submodule "discount"] 5 | path = discount 6 | url = https://github.com/Orc/discount.git 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /History.md: -------------------------------------------------------------------------------- 1 | 2 | 0.2.3 / 2012-01-09 3 | ================== 4 | 5 | * Added compatibility with node 0.6.x. 6 | 7 | 0.2.2 / 2011-09-13 8 | ================== 9 | 10 | * Fixed: compile discount with -fPIC [visnup] 11 | 12 | 0.2.1 / 2011-09-13 13 | ================== 14 | 15 | * Changed: submodule discount and statically link to it [visnup] 16 | 17 | 0.2.0 / 2011-07-27 18 | ================== 19 | 20 | * Added support for flags [afriggeri] 21 | 22 | 0.1.3 / 2011-04-15 23 | ================== 24 | 25 | * Add -fPIC and -mimpure-text [isaacs] 26 | 27 | 0.0.1 / 2010-04-07 28 | ================== 29 | 30 | * Initial release -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Markdown.js 3 | 4 | node bindings for the C "discount" markdown implementation by David Parsons. 5 | 6 | ## Installation 7 | 8 | $ npm install discount 9 | 10 | ## Usage 11 | 12 | var md = require('discount'); 13 | md.parse('markdown is *awesome*') 14 | // => '
markdown is awesome
' 15 | 16 | ### Flags 17 | 18 | md.parse('[links](http://github.com/) are *not* allowed here', md.flags.noLinks) 19 | // => '[links](http://github.com/) are not allowed here
' 20 | 21 | All [Discount flags](http://www.pell.portland.or.us/~orc/Code/discount/#flags) are supported: 22 | `noLinks`, `noImage`, `noPants`, `noHTML`, `strict`, `tagText`, `noExt`, `cdata`, `noSuperscript`, `noRelaxed`, `noTables`, `noStrikethrough`, `toc`, `md1Compat`, `autolink`, `safelink`, `noHeader`, `tabStop`, `noDivQuote`, `noAlphaList`, `noDlist` and `extraFootnote`. 23 | 24 | ## License 25 | 26 | (The MIT License) 27 | 28 | Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca> 29 | 30 | Permission is hereby granted, free of charge, to any person obtaining 31 | a copy of this software and associated documentation files (the 32 | 'Software'), to deal in the Software without restriction, including 33 | without limitation the rights to use, copy, modify, merge, publish, 34 | distribute, sublicense, and/or sell copies of the Software, and to 35 | permit persons to whom the Software is furnished to do so, subject to 36 | the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be 39 | included in all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 42 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 43 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 44 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 45 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 46 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /examples/example.md: -------------------------------------------------------------------------------- 1 | # Title 2 | 3 | [this is a link](http://foo) 4 | Just some random paragraph stuff here. 5 | 6 | ## Lists 7 | 8 | - oh sweet 9 | - some list 10 | - items 11 | 1. booyah! √ 12 | 2. awesome √ 13 | 14 | ## Code 15 | 16 | Even some code: 17 | 18 | foobar! 19 | bazz! 20 | 21 | ~~strikethrough~~ -------------------------------------------------------------------------------- /examples/flags.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var md = require('../build/default/markdown') 7 | , fs = require('fs'); 8 | 9 | fs.readFile(__dirname + '/example.md', 'utf8', function(err, str){ 10 | console.log(md.parse(str, md.flags.noStrikethrough|md.flags.noLinks)); 11 | }); -------------------------------------------------------------------------------- /examples/run.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var md = require('../build/default/markdown') 7 | , fs = require('fs'); 8 | 9 | fs.readFile(__dirname + '/example.md', 'utf8', function(err, str){ 10 | console.log(md.parse(str)); 11 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { "name": "discount" 2 | , "description": "C markdown implementation using discount" 3 | , "tags": ["markdown", "md", "parser", "native"] 4 | , "author" : "TJ Holowaychuk