{"name":"to-markdown","description":"HTML-to-Markdown converter","version":"3.0.1","author":{"name":"Dom Christie"},"browser":{"jsdom":false},"dependencies":{"collapse-whitespace":"1.1.2","jsdom":"^9.0.0"},"devDependencies":{"qunit":"^0.7.6","saucie":"0.1.3","standard":"^6.0.8","testem":"^0.8.2","watchify":"^2.5.0"},"engines":{"node":"^4"},"keywords":["markdown"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/domchristie/to-markdown.git"},"scripts":{"start":"watchify -s toMarkdown -o dist/to-markdown.js index.js -v","test":"standard index.js lib/**/*.js test/**/*.js && qunit -c ./index.js -t ./test/to-markdown-test.js ./test/gfm-test.js"},"url":"http://domchristie.github.com/to-markdown/","gitHead":"55d8f2a5c3b98d0e16f31b7ae4b02f344fbf7e2e","bugs":{"url":"https://github.com/domchristie/to-markdown/issues"},"homepage":"https://github.com/domchristie/to-markdown#readme","_id":"to-markdown@3.0.1","_shasum":"2fffa7a8806739e3ca95f239e9b66a8afe06b185","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"dist":{"shasum":"2fffa7a8806739e3ca95f239e9b66a8afe06b185","tarball":"http://registry-npm.ywwl.com/to-markdown/download/to-markdown-3.0.1.tgz","integrity":"sha512-GFe4lgwe5Mtk6vKWgVCmG2dF/9RR6HJPghaWHqMW58RG35BCAuLkWulRWS5iGqTFDyVo9BXqpNwWLTFYJw8dbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNuXW353fE8GqHGDbCa4JcxeDYnPqp5vrHM8O8kabTvQIhAI9yaed56Oq7Ggufigc9gweUrHpbXvLtgFfLe/j9WmrQ"}],"size":16415,"noattachment":false,"key":"/to-markdown/-/to-markdown-3.0.1.tgz"},"maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/to-markdown-3.0.1.tgz_1468144347982_0.32355114235542715"},"deprecated":"to-markdown has been renamed to Turndown, with a new API. Please update to turndown v4.0.0 or above and see the migration guide for details: https://github.com/domchristie/turndown/wiki/Migrating-from-to-markdown-to-Turndown","directories":{},"readme":"# to-markdown\n\n## From version 4, to-markdown will be renamed to **turndown** with an updated API. Please see the [migration guide](https://github.com/domchristie/to-markdown/wiki/Migrating-from-to-markdown-to-Turndown) for details.\n\nAn HTML to Markdown converter written in JavaScript.\n\nThe API is as follows:\n\n```js\ntoMarkdown(stringOfHTML, options);\n```\n\n**Note** to-markdown v2+ runs on Node 4+. For a version compatible with Node 0.10 - 0.12, please use [to-markdown v1.x](https://github.com/domchristie/to-markdown/tree/1.x).\n\n## Installation\n\n### Browser\n\nDownload the compiled script located at `dist/to-markdown.js`.\n\n```html\n<script src=\"PATH/TO/to-markdown.js\"></script>\n<script>toMarkdown('<h1>Hello world!</h1>')</script>\n```\n\nOr with **Bower**:\n\n```sh\n$ bower install to-markdown\n```\n\n```html\n<script src=\"PATH/TO/bower_components/to-markdown/dist/to-markdown.js\"></script>\n<script>toMarkdown('<h1>Hello world!</h1>')</script>\n```\n\n### Node.js\n\nInstall the `to-markdown` module:\n\n```sh\n$ npm install to-markdown\n```\n\nThen you can use it like below:\n\n```js\nvar toMarkdown = require('to-markdown');\ntoMarkdown('<h1>Hello world!</h1>');\n```\n\n(Note it is no longer necessary to call `.toMarkdown` on the required module as of v1.)\n\n## Options\n\n### `converters` (array)\n\nto-markdown can be extended by passing in an array of converters to the options object:\n\n```js\ntoMarkdown(stringOfHTML, { converters: [converter1, converter2, …] });\n```\n\nA converter object consists of a **filter**, and a **replacement**. This example from the source replaces `code` elements:\n\n```js\n{\n  filter: 'code',\n  replacement: function(content) {\n    return '`' + content + '`';\n  }\n}\n```\n\n#### `filter` (string|array|function)\n\nThe filter property determines whether or not an element should be replaced. DOM nodes can be selected simply by filtering by tag name, with strings or with arrays of strings:\n\n * `filter: 'p'` will select `p` elements\n * `filter: ['em', 'i']` will select `em` or `i` elements\n\nAlternatively, the filter can be a function that returns a boolean depending on whether a given node should be replaced. The function is passed a DOM node as its only argument. For example, the following will match any `span` element with an `italic` font style:\n\n```js\nfilter: function (node) {\n  return node.nodeName === 'SPAN' && /italic/i.test(node.style.fontStyle);\n}\n```\n\n#### `replacement` (function)\n\nThe replacement function determines how an element should be converted. It should return the markdown string for a given node. The function is passed the node’s content, as well as the node itself (used in more complex conversions). It is called in the context of `toMarkdown`, and therefore has access to the methods detailed below.\n\nThe following converter replaces heading elements (`h1`-`h6`):\n\n```js\n{\n  filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],\n\n  replacement: function(innerHTML, node) {\n    var hLevel = node.tagName.charAt(1);\n    var hPrefix = '';\n    for(var i = 0; i < hLevel; i++) {\n      hPrefix += '#';\n    }\n    return '\\n' + hPrefix + ' ' + innerHTML + '\\n\\n';\n  }\n}\n```\n\n### `gfm` (boolean)\n\nto-markdown has beta support for GitHub flavored markdown (GFM). Set the `gfm` option to true:\n\n```js\ntoMarkdown('<del>Hello world!</del>', { gfm: true });\n```\n\n## Methods\n\nThe following methods can be called on the `toMarkdown` object.\n\n### `isBlock(node)`\n\nReturns `true`/`false` depending on whether the element is block level.\n\n### `isVoid(node)`\n\nReturns `true`/`false` depending on whether the element is [void](http://www.w3.org/TR/html-markup/syntax.html#syntax-elements).\n\n### `outer(node)`\n\nReturns the content of the node along with the element itself.\n\n## Development\n\nFirst make sure you have node.js/npm installed, then:\n\n```sh\n$ npm install --dev\n$ bower install --dev\n```\n\nAutomatically browserify the module when source files change by running:\n\n```sh\n$ npm start\n```\n\n### Tests\n\nTo run the tests in the browser, open `test/index.html`.\n\nTo run in node.js:\n\n```sh\n$ npm test\n```\n\n## Credits\n\nThanks to all [contributors](https://github.com/domchristie/to-markdown/graphs/contributors). Also, thanks to [Alex Cornejo](https://github.com/acornejo) for advice and inspiration for the breadth-first search algorithm.\n\n## Licence\n\nto-markdown is copyright &copy; 2011+ [Dom Christie](http://domchristie.co.uk) and released under the MIT license.\n","publish_time":1468144349513,"_cnpm_publish_time":1468144349513,"dist-tags":{"latest":"3.1.1"}}