|
@@ -1,92 +1,70 @@
|
|
-Showdown
|
|
|
|
---------
|
|
|
|
|
|
+
|
|
|
|
|
|
-A Markdown to HTML converter written in Javascript
|
|
|
|
|
|
+[](https://travis-ci.org/showdownjs/showdown)
|
|
|
|
|
|
-## Note
|
|
|
|
|
|
+Showdown is a Javascript Markdown to HTML converter, based on the original works by John Gruber. Showdown can be used client side (in the browser) or server side (with NodeJs).
|
|
|
|
|
|
- > Showdown is now maintained by the [showdownjs](https://github.com/showdownjs) organization on Github.
|
|
|
|
- >
|
|
|
|
- > The organization needs members to maintain Showdown.
|
|
|
|
- >
|
|
|
|
- > Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.
|
|
|
|
|
|
|
|
-## Original Attributions
|
|
|
|
|
|
+## Installation
|
|
|
|
|
|
-Showdown Copyright (c) 2007 John Fraser.
|
|
|
|
-<http://www.attacklab.net/>
|
|
|
|
|
|
+### Download tarball
|
|
|
|
|
|
-Original Markdown Copyright (c) 2004-2005 John Gruber
|
|
|
|
-<http://daringfireball.net/projects/markdown/>
|
|
|
|
|
|
+You can download the latest release's tarball directly from https://github.com/showdownjs/showdown/releases
|
|
|
|
|
|
-Redistributable under a BSD-style open source license.
|
|
|
|
-See license.txt for more information.
|
|
|
|
|
|
+### Bower
|
|
|
|
|
|
-## Quick Example
|
|
|
|
|
|
+ bower install showdown
|
|
|
|
|
|
-```js
|
|
|
|
-var Showdown = require('showdown');
|
|
|
|
-var converter = new Showdown.converter();
|
|
|
|
|
|
+### npm (server-side)
|
|
|
|
|
|
-converter.makeHtml('#hello markdown!');
|
|
|
|
|
|
+ npm install showdown
|
|
|
|
|
|
-// <h1 id="hellomarkdown">hello, markdown</h1>
|
|
|
|
-```
|
|
|
|
|
|
|
|
-## What's it for?
|
|
|
|
|
|
+## Browser Compatibility
|
|
|
|
|
|
-Developers can use Showdown to:
|
|
|
|
|
|
+Showdown has been tested successfully with:
|
|
|
|
|
|
- * Add in-browser preview to existing Markdown apps
|
|
|
|
|
|
+ * Firefox 1.5 and 2.0
|
|
|
|
+ * Internet Explorer 6 and 7
|
|
|
|
+ * Safari 2.0.4
|
|
|
|
+ * Opera 8.54 and 9.10
|
|
|
|
+ * Netscape 8.1.2
|
|
|
|
+ * Konqueror 3.5.4
|
|
|
|
|
|
- Showdown's output is (almost always) identical to
|
|
|
|
- markdown.pl's, so the server can reproduce exactly
|
|
|
|
- the output that the user saw. (See below for
|
|
|
|
- exceptions.)
|
|
|
|
|
|
+In theory, Showdown will work in any browser that supports ECMA 262 3rd Edition (JavaScript 1.5). The converter itself might even work in things that aren't web browsers, like Acrobat. No promises.
|
|
|
|
|
|
- * Add Markdown input to programs that don't support it
|
|
|
|
|
|
|
|
- Any app that accepts HTML input can now be made to speak
|
|
|
|
- Markdown by modifying the input pages's HTML. If your
|
|
|
|
- application lets users edit documents again later,
|
|
|
|
- then they won't have access to the original Markdown
|
|
|
|
- text. But this should be good enough for many
|
|
|
|
- uses -- and you can do it with just a two-line
|
|
|
|
- `onsubmit` function!
|
|
|
|
|
|
+## Node compatibility
|
|
|
|
|
|
- * Add Markdown input to closed-source web apps
|
|
|
|
|
|
+Showdown has been tested with node 0.8 and 0.10. However, it should work with previous versions, such as node 0.6.
|
|
|
|
|
|
- You can write bookmarklets or userscripts to extend
|
|
|
|
- any standard textarea on the web so that it accepts
|
|
|
|
- Markdown instead of HTML. With a little more hacking,
|
|
|
|
- the same can probably be done with many rich edit
|
|
|
|
- controls.
|
|
|
|
|
|
|
|
- * Build new web apps from scratch
|
|
|
|
|
|
+## Quick Example
|
|
|
|
|
|
- A Showdown front-end can send back text in Markdown,
|
|
|
|
- HTML or both, so you can trade bandwidth for server
|
|
|
|
- load to reduce your cost of operation. If your app
|
|
|
|
- requires JavaScript, you won't need to do any
|
|
|
|
- Markdown processing on the server at all. (For most
|
|
|
|
- uses, you'll still need to sanitize the HTML before
|
|
|
|
- showing it to other users -- but you'd need to do
|
|
|
|
- that anyway if you're allowing raw HTML in your
|
|
|
|
- Markdown.)
|
|
|
|
|
|
+### Node
|
|
|
|
|
|
|
|
+```js
|
|
|
|
+var showdown = require('showdown'),
|
|
|
|
+ converter = new showdown.Converter(),
|
|
|
|
+ text = '#hello, markdown!',
|
|
|
|
+ html = converter.makeHtml(text);
|
|
|
|
+```
|
|
|
|
|
|
-## Browser Compatibility
|
|
|
|
|
|
+### Browser
|
|
|
|
|
|
-Showdown has been tested successfully with:
|
|
|
|
|
|
+```js
|
|
|
|
+var converter = new showdown.Converter(),
|
|
|
|
+ text = '#hello, markdown!',
|
|
|
|
+ html = converter.makeHtml(text);
|
|
|
|
+```
|
|
|
|
|
|
- * Firefox 1.5 and 2.0
|
|
|
|
- * Internet Explorer 6 and 7
|
|
|
|
- * Safari 2.0.4
|
|
|
|
- * Opera 8.54 and 9.10
|
|
|
|
- * Netscape 8.1.2
|
|
|
|
- * Konqueror 3.5.4
|
|
|
|
|
|
+### Output
|
|
|
|
|
|
-In theory, Showdown will work in any browser that supports ECMA 262 3rd Edition (JavaScript 1.5). The converter itself might even work in things that aren't web browsers, like Acrobat. No promises.
|
|
|
|
|
|
+Both examples should output...
|
|
|
|
+
|
|
|
|
+```html
|
|
|
|
+<h1 id="hellomarkdown">hello, markdown!</h1>
|
|
|
|
+```
|
|
|
|
|
|
|
|
|
|
## Extensions
|
|
## Extensions
|
|
@@ -96,24 +74,32 @@ Showdown allows additional functionality to be loaded via extensions.
|
|
### Client-side Extension Usage
|
|
### Client-side Extension Usage
|
|
|
|
|
|
```js
|
|
```js
|
|
-<script src="src/showdown.js" />
|
|
|
|
-<script src="src/extensions/twitter.js" />
|
|
|
|
|
|
+<script src="showdown.js" />
|
|
|
|
+<script src="twitter-extension.js" />
|
|
|
|
|
|
-var converter = new Showdown.converter({ extensions: 'twitter' });
|
|
|
|
|
|
+var converter = new showdown.Converter({ extensions: 'twitter' });
|
|
```
|
|
```
|
|
|
|
|
|
### Server-side Extension Usage
|
|
### Server-side Extension Usage
|
|
|
|
|
|
```js
|
|
```js
|
|
-// Using a bundled extension
|
|
|
|
-var Showdown = require('showdown');
|
|
|
|
-var converter = new Showdown.converter({ extensions: ['twitter'] });
|
|
|
|
-
|
|
|
|
-// Using a custom extension
|
|
|
|
-var mine = require('./custom-extensions/mine');
|
|
|
|
-var converter = new Showdown.converter({ extensions: ['twitter', mine] });
|
|
|
|
|
|
+var showdown = require('showdown'),
|
|
|
|
+ myExtension = require('myExtension'),
|
|
|
|
+ converter = new showdown.Converter({ extensions: ['myExtension'] });
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+## Tests
|
|
|
|
+
|
|
|
|
+A suite of tests is available which require node.js. Once node is installed, run the following command from the project root to install the development dependencies:
|
|
|
|
+
|
|
|
|
+ npm install --dev
|
|
|
|
+
|
|
|
|
+Once installed the tests can be run from the project root using:
|
|
|
|
+
|
|
|
|
+ npm test
|
|
|
|
+
|
|
|
|
+New test cases can easily be added. Create a markdown file (ending in `.md`) which contains the markdown to test. Create a `.html` file of the exact same name. It will automatically be tested when the tests are executed with `mocha`.
|
|
|
|
+
|
|
|
|
|
|
## Known Differences in Output
|
|
## Known Differences in Output
|
|
|
|
|
|
@@ -198,19 +184,6 @@ In most cases, Showdown's output is identical to that of Perl Markdown v1.0.2b7.
|
|
Showdown won't. But still, don't do that.
|
|
Showdown won't. But still, don't do that.
|
|
|
|
|
|
|
|
|
|
-## Tests
|
|
|
|
-
|
|
|
|
-A suite of tests is available which require node.js. Once node is installed, run the following command from the project root to install the development dependencies:
|
|
|
|
-
|
|
|
|
- npm install --dev
|
|
|
|
-
|
|
|
|
-Once installed the tests can be run from the project root using:
|
|
|
|
-
|
|
|
|
- npm test
|
|
|
|
-
|
|
|
|
-New test cases can easily be added. Create a markdown file (ending in `.md`) which contains the markdown to test. Create a `.html` file of the exact same name. It will automatically be tested when the tests are executed with `mocha`.
|
|
|
|
-
|
|
|
|
-
|
|
|
|
## Creating Markdown Extensions
|
|
## Creating Markdown Extensions
|
|
|
|
|
|
A showdown extension is simply a function which returns an array of extensions. Each single extension can be one of two types:
|
|
A showdown extension is simply a function which returns an array of extensions. Each single extension can be one of two types:
|
|
@@ -282,15 +255,20 @@ Second, client-side extensions should add a property onto `Showdown.extensions`
|
|
The showdown test runner is setup to automatically test cases for extensions. To add test cases for an extension, create a new folder under `./test/extensions` which matches the name of the `.js` file in `./src/extensions`. Place any test cases into the folder using the md/html format and they will automatically be run when tests are run.
|
|
The showdown test runner is setup to automatically test cases for extensions. To add test cases for an extension, create a new folder under `./test/extensions` which matches the name of the `.js` file in `./src/extensions`. Place any test cases into the folder using the md/html format and they will automatically be run when tests are run.
|
|
|
|
|
|
|
|
|
|
-## Credits
|
|
|
|
|
|
+## Contributing
|
|
|
|
+The organization needs members to maintain Showdown.
|
|
|
|
+Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.
|
|
|
|
|
|
- - Showdown v2
|
|
|
|
- * [Estevão Santos](http://soares-dos-santos.com)<br/>
|
|
|
|
- Code Refactoring and Project Maintainer
|
|
|
|
|
|
|
|
- - Showdown v1
|
|
|
|
- * [Corey Innis](http://github.com/coreyti):<br/>
|
|
|
|
|
|
+## Credits
|
|
|
|
+
|
|
|
|
+ - Showdown
|
|
|
|
+ * [Estevão Santos](http://soares-dos-santos.com):<br/>
|
|
GitHub project maintainer
|
|
GitHub project maintainer
|
|
|
|
+ * [Pascal Deschênes](https://github.com/pdeschen):<br/>
|
|
|
|
+ Grunt support, extension fixes + additions, packaging improvements, documentation
|
|
|
|
+ * [Corey Innis](http://github.com/coreyti):<br/>
|
|
|
|
+ Original GitHub project maintainer
|
|
* [Remy Sharp](https://github.com/remy/):<br/>
|
|
* [Remy Sharp](https://github.com/remy/):<br/>
|
|
CommonJS-compatibility and more
|
|
CommonJS-compatibility and more
|
|
* [Konstantin Käfer](https://github.com/kkaefer/):<br/>
|
|
* [Konstantin Käfer](https://github.com/kkaefer/):<br/>
|
|
@@ -311,10 +289,7 @@ The showdown test runner is setup to automatically test cases for extensions. T
|
|
Regex optimization
|
|
Regex optimization
|
|
* [Adam Backstrom](https://github.com/abackstrom):<br/>
|
|
* [Adam Backstrom](https://github.com/abackstrom):<br/>
|
|
WebKit bugfix
|
|
WebKit bugfix
|
|
- * [Pascal Deschênes](https://github.com/pdeschen):<br/>
|
|
|
|
- Grunt support, extension fixes + additions, packaging improvements, documentation
|
|
|
|
- * [Estevão Santos](http://soares-dos-santos.com):<br/>
|
|
|
|
- Bug fixes and later maintainer
|
|
|
|
|
|
+
|
|
|
|
|
|
- Original Project
|
|
- Original Project
|
|
* [John Gruber](http://daringfireball.net/projects/markdown/)<br/>
|
|
* [John Gruber](http://daringfireball.net/projects/markdown/)<br/>
|