-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
89 lines (89 loc) · 13.2 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
"name": "showdown-ghost",
"version": "0.3.6",
"descriotion": "Slightly updated version of showdown used in Ghost",
"author": {
"name": "John Fraser"
},
"scripts": {
"test": "grunt test"
},
"contributors": [
{
"name": "Hannah Wolfe"
},
{
"name": "John Gruber"
},
{
"name": "John Fraser"
},
{
"name": "Corey Innis"
},
{
"name": "Remy Sharp"
},
{
"name": "Konstantin Käfer"
},
{
"name": "Roger Braun"
},
{
"name": "Dominic Tarr"
},
{
"name": "Cat Chen"
},
{
"name": "Titus Stone"
},
{
"name": "Rob Sutherland"
},
{
"name": "Pavel Lang"
},
{
"name": "Ben Combee"
},
{
"name": "Adam Backstrom"
},
{
"name": "Pascal Deschênes"
}
],
"repository": {
"type": "git",
"url": "git+https://github.com/erisds/showdown.git#ghost",
"web": "https://github.com/coreyti/showdown"
},
"devDependencies": {
"mocha": "1.3.0",
"grunt": "0.4.2",
"grunt-simple-mocha": "*",
"grunt-mocha": "~0.4.7",
"should": "1.2.0",
"grunt-contrib-jshint": "0.10.0"
},
"licenses": [
{
"type": "BSD",
"url": "https://github.com/coreyti/showdown/raw/master/license.txt"
}
],
"main": "./src/showdown",
"readme": "# Showdown\r\n\r\nA JavaScript port of Markdown\r\n\r\n## Note\r\n\r\n > Showdown is now maintained by the [showdownjs](https://github.com/showdownjs) organization on Github.\r\n > \r\n > The organization needs members to maintain Showdown.\r\n > \r\n > Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.\r\n\r\n## Original Attributions\r\n\r\nShowdown Copyright (c) 2007 John Fraser.\r\n<http://www.attacklab.net/>\r\n\r\nOriginal Markdown Copyright (c) 2004-2005 John Gruber\r\n<http://daringfireball.net/projects/markdown/>\r\n\r\nRedistributable under a BSD-style open source license.\r\nSee license.txt for more information.\r\n\r\n## Quick Example\r\n\r\n```js\r\nvar Showdown = require('showdown');\r\nvar converter = new Showdown.converter();\r\n\r\nconverter.makeHtml('#hello markdown!');\r\n\r\n// <h1 id=\"hellomarkdown\">hello, markdown</h1>\r\n```\r\n\r\n## What's it for?\r\n\r\nDevelopers can use Showdown to:\r\n\r\n * Add in-browser preview to existing Markdown apps\r\n\r\n Showdown's output is (almost always) identical to\r\n markdown.pl's, so the server can reproduce exactly\r\n the output that the user saw. (See below for\r\n exceptions.)\r\n\r\n * Add Markdown input to programs that don't support it\r\n\r\n Any app that accepts HTML input can now be made to speak\r\n Markdown by modifying the input pages's HTML. If your\r\n application lets users edit documents again later,\r\n then they won't have access to the original Markdown\r\n text. But this should be good enough for many\r\n uses -- and you can do it with just a two-line\r\n `onsubmit` function!\r\n\r\n * Add Markdown input to closed-source web apps\r\n\r\n You can write bookmarklets or userscripts to extend\r\n any standard textarea on the web so that it accepts\r\n Markdown instead of HTML. With a little more hacking,\r\n the same can probably be done with many rich edit\r\n controls.\r\n\r\n * Build new web apps from scratch\r\n\r\n A Showdown front-end can send back text in Markdown,\r\n HTML or both, so you can trade bandwidth for server\r\n load to reduce your cost of operation. If your app\r\n requires JavaScript, you won't need to do any\r\n Markdown processing on the server at all. (For most\r\n uses, you'll still need to sanitize the HTML before\r\n showing it to other users -- but you'd need to do\r\n that anyway if you're allowing raw HTML in your\r\n Markdown.)\r\n\r\n\r\n## Browser Compatibility\r\n\r\nShowdown has been tested successfully with:\r\n\r\n * Firefox 1.5 and 2.0\r\n * Internet Explorer 6 and 7\r\n * Safari 2.0.4\r\n * Opera 8.54 and 9.10\r\n * Netscape 8.1.2\r\n * Konqueror 3.5.4\r\n\r\nIn 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.\r\n\r\n\r\n## Extensions\r\n\r\nShowdown allows additional functionality to be loaded via extensions.\r\n\r\n### Client-side Extension Usage\r\n\r\n```js\r\n<script src=\"src/showdown.js\" />\r\n<script src=\"src/extensions/twitter.js\" />\r\n\r\nvar converter = new Showdown.converter({ extensions: 'twitter' });\r\n```\r\n\r\n### Server-side Extension Usage\r\n\r\n```js\r\n// Using a bundled extension\r\nvar Showdown = require('showdown');\r\nvar converter = new Showdown.converter({ extensions: ['twitter'] });\r\n\r\n// Using a custom extension\r\nvar mine = require('./custom-extensions/mine');\r\nvar converter = new Showdown.converter({ extensions: ['twitter', mine] });\r\n```\r\n\r\n\r\n## Known Differences in Output\r\n\r\nIn most cases, Showdown's output is identical to that of Perl Markdown v1.0.2b7. What follows is a list of all known deviations. Please file an issue if you find more.\r\n\r\n * This release uses the HTML parser from Markdown 1.0.2b2,\r\n which means it fails `Inline HTML (Advanced).text` from\r\n the Markdown test suite:\r\n\r\n <div>\r\n <div>\r\n unindented == broken\r\n </div>\r\n </div>\r\n\r\n * Showdown doesn't support the markdown=\"1\" attribute:\r\n\r\n <div markdown=\"1\">\r\n Markdown does *not* work in here.\r\n </div>\r\n\r\n This is half laziness on my part and half stubbornness.\r\n Markdown is smart enough to process the contents of span-\r\n level tags without screwing things up; shouldn't it be\r\n able to do the same inside block elements? Let's find a\r\n way to make markdown=\"1\" the default.\r\n\r\n\r\n * You can only nest square brackets in link titles to a\r\n depth of two levels:\r\n\r\n [[fine]](http://www.attacklab.net/)\r\n [[[broken]]](http://www.attacklab.net/)\r\n\r\n If you need more, you can escape them with backslashes.\r\n\r\n\r\n * When sublists have paragraphs, Showdown produces equivalent\r\n HTML with a slightly different arrangement of newlines:\r\n\r\n + item\r\n\r\n - subitem\r\n\r\n The HTML has a superfluous newline before this\r\n paragraph.\r\n\r\n - subitem\r\n\r\n The HTML here is unchanged.\r\n\r\n - subitem\r\n\r\n The HTML is missing a newline after this\r\n list subitem.\r\n\r\n\r\n\r\n * Markdown.pl creates empty title attributes for\r\n inline-style images:\r\n\r\n Here's an empty title on an inline-style\r\n ![image](http://w3.org/Icons/valid-xhtml10).\r\n\r\n I tried to replicate this to clean up my diffs during\r\n testing, but I went too far: now Showdown also makes\r\n empty titles for reference-style images:\r\n\r\n Showdown makes an empty title for\r\n reference-style ![images][] too.\r\n\r\n [images]: http://w3.org/Icons/valid-xhtml10\r\n\r\n\r\n * With crazy input, Markdown will mistakenly put\r\n `<strong>` or `<em>` tags in URLs:\r\n\r\n <a href=\"<*Markdown adds em tags in here*>\">\r\n improbable URL\r\n </a>\r\n\r\n Showdown won't. But still, don't do that.\r\n\r\n\r\n## Tests\r\n\r\nA 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:\r\n\r\n npm install --dev\r\n\r\nGrunt is used to task run mocha tests and jshint validation. Install the grunt-cli tool globally:\r\n\r\n npm install grunt-cli -g\r\n\r\nOnce installed the tests can be run from the project root using:\r\n\r\n npm test\r\n\r\nNew 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`.\r\n\r\n\r\n## Creating Markdown Extensions\r\n\r\nA showdown extension is simply a function which returns an array of extensions. Each single extension can be one of two types:\r\n\r\n * Language Extension -- Language extensions are ones that that add new markdown syntax to showdown. For example, say you wanted `^^youtube http://www.youtube.com/watch?v=oHg5SJYRHA0` to automatically render as an embedded YouTube video, that would be a language extension.\r\n * Output Modifiers -- After showdown has run, and generated HTML, an output modifier would change that HTML. For example, say you wanted to change `<div class=\"header\">` to be `<header>`, that would be an output modifier.\r\n\r\nEach extension can provide two combinations of interfaces for showdown.\r\n\r\n### Regex/Replace\r\n\r\nRegex/replace style extensions are very similar to javascripts `string.replace` function. Two properties are given, `regex` and `replace`. `regex` is a string and `replace` can be either a string or a function. If `replace` is a string, it can use the `$1` syntax for group substitution, exactly as if it were making use of `string.replace` (internally it does this actually); The value of `regex` is assumed to be a global replacement.\r\n\r\n**Example:**\r\n\r\n```js\r\nvar demo = function(converter) {\r\n return [\r\n // Replace escaped @ symbols\r\n { type: 'lang', regex: '\\\\@', replace: '@' }\r\n ];\r\n}\r\n```\r\n\r\n### Filter\r\n\r\nAlternately, if you'd just like to do everything yourself, you can specify a filter which is a callback with a single input parameter, text (the current source text within the showdown engine).\r\n\r\n**Example:**\r\n\r\n```js\r\nvar demo = function(converter) {\r\n return [\r\n // Replace escaped @ symbols\r\n { type: 'lang', function(text) {\r\n return text.replace(/\\\\@/g, '@');\r\n }}\r\n ];\r\n}\r\n```\r\n\r\n### Implementation Concerns\r\n\r\nOne bit which should be taken into account is maintaining both client-side and server-side compatibility. This can be achieved with a few lines of boilerplate code. First, to prevent polluting the global scope for client-side code, the extension definition should be wrapped in a self-executing function.\r\n\r\n```js\r\n(function(){\r\n // Your extension here\r\n}());\r\n```\r\n\r\nSecond, client-side extensions should add a property onto `Showdown.extensions` which matches the name of the file. As an example, a file named `demo.js` should then add `Showdown.extensions.demo`. Server-side extensions can simply export themselves.\r\n\r\n```js\r\n(function(){\r\n var demo = function(converter) {\r\n // ... extension code here ...\r\n };\r\n\r\n // Client-side export\r\n if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.demo = demo; }\r\n // Server-side export\r\n if (typeof module !== 'undefined') module.exports = demo;\r\n}());\r\n```\r\n\r\n### Testing Extensions\r\n\r\nThe 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 filder using the md/html format and they will automatically be run when tests are run.\r\n\r\n\r\n## Credits\r\n\r\n * Origins\r\n * [John Fraser](http://attacklab.net/):<br/>\r\n Author of Showdown\r\n * [John Gruber](http://daringfireball.net/projects/markdown/):<br/>\r\n Author of Markdown\r\n * Maintenance/Contributions (roughly chronologically)\r\n * [Corey Innis](http://github.com/coreyti):<br/>\r\n GitHub project maintainer\r\n * [Remy Sharp](https://github.com/remy/):<br/>\r\n CommonJS-compatibility and more\r\n * [Konstantin Käfer](https://github.com/kkaefer/):<br/>\r\n CommonJS packaging\r\n * [Roger Braun](https://github.com/rogerbraun):<br/>\r\n Github-style code blocks\r\n * [Dominic Tarr](https://github.com/dominictarr):<br/>\r\n Documentation\r\n * [Cat Chen](https://github.com/CatChen):<br/>\r\n Export fix\r\n * [Titus Stone](https://github.com/tstone):<br/>\r\n Mocha tests, extension mechanism, and bug fixes\r\n * [Rob Sutherland](https://github.com/roberocity):<br/>\r\n The idea that lead to extensions\r\n * [Pavel Lang](https://github.com/langpavel):<br/>\r\n Code cleanup\r\n * [Ben Combee](https://github.com/unwiredben):<br/>\r\n Regex optimization\r\n * [Adam Backstrom](https://github.com/abackstrom):<br/>\r\n WebKit bugfix\r\n * [Pascal Deschênes](https://github.com/pdeschen):<br/>\r\n Grunt support, extension fixes + additions, packaging improvements, documentation\r\n",
"readmeFilename": "README.md",
"description": "A JavaScript port of Markdown",
"bugs": {
"url": "https://github.com/erisds/showdown/issues"
},
"homepage": "https://github.com/erisds/showdown/tree/ghost#readme",
"_id": "showdown-ghost@0.3.6",
"_shasum": "ec73685cc5b4790352b00ed9e2cb26efc337d2f1",
"_resolved": "https://registry.npmjs.org/showdown-ghost/-/showdown-ghost-0.3.6.tgz",
"_from": "https://registry.npmjs.org/showdown-ghost/-/showdown-ghost-0.3.6.tgz"
}