{"name":"markdown-it-decorate","description":"Add classes, identifiers and attributes to your markdown with HTML comments","version":"1.2.2","author":{"name":"Rico Sta. Cruz","email":"rico@ricostacruz.com"},"bugs":{"url":"https://github.com/rstacruz/markdown-it-decorate/issues"},"dependencies":{},"devDependencies":{"istanbul":"0.4.5","markdown-it":"8.2.2","standard":"8.6.0","tap-spec":"4.1.1","tape":"4.6.3"},"directories":{"test":"test"},"homepage":"https://github.com/rstacruz/markdown-it-decorate#readme","files":[],"keywords":["attribute","class","curly brackets","header_attributes","id","identifier","markdown-it","markdown-it-plugin","pandoc"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/rstacruz/markdown-it-decorate.git"},"scripts":{"test":"node test/index.js | tap-spec","lint":"standard","coverage":"istanbul cover test/index.js"},"gitHead":"1b91d90e6874f2214d64b35a0fcc780f90ac5d11","_id":"markdown-it-decorate@1.2.2","_shasum":"f1e11d11d837ae78906198f8a2c974f0e646acb7","_from":".","_npmVersion":"4.0.3","_nodeVersion":"6.3.0","_npmUser":{"name":"rstacruz","email":"dropbox@ricostacruz.com"},"dist":{"shasum":"f1e11d11d837ae78906198f8a2c974f0e646acb7","tarball":"http://registry-npm.ywwl.com/markdown-it-decorate/download/markdown-it-decorate-1.2.2.tgz","integrity":"sha512-7BFWJ97KBXgkaPVjKHISQnhSW8RWQ7yRNXpr8pPUV2Rw4GHvGrgb6CelKCM+GSijP0uSLCAVfc/knWIz+2v/Sw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICfhwklXatIFVCKClQ8hevShjmrbwLEUvjPDRaRAQuO3AiEA3tb2F4f71txntQwY+nRHvWSMiszAheT1WAvOGUsnmmI="}],"size":5782,"noattachment":false,"key":"/markdown-it-decorate/-/markdown-it-decorate-1.2.2.tgz"},"maintainers":[{"name":"rstacruz","email":"rico@ricostacruz.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/markdown-it-decorate-1.2.2.tgz_1483341283891_0.5403825596440583"},"readme":"# markdown-it-decorate\n\n> Add attributes, IDs and classes to Markdown\n\nAnnotate your Markdown documents with HTML comments to add classes to HTML elements. Supported for and tested on [markdown-it] 6.x, 7.x, and 8.x.\n\n```html\nHello, from *Markdown*!\n<!-- {.center} -->\n```\n\n```html\n<p class='center'>Hello, from <em>Markdown</em>!</p>\n```\n\n[![Status](https://travis-ci.org/rstacruz/markdown-it-decorate.svg?branch=master)](https://travis-ci.org/rstacruz/markdown-it-decorate \"See test builds\")\n\n## Usage\n\nInstall the `markdown-it-decorate` package alongside `markdown-it` (they are peer dependencies).\n\n```sh\nyarn add --exact markdown-it markdown-it-decorate\n# or:\nnpm install --save --save-exact markdown-it markdown-it-decorate\n```\n\n`markdown-it-decorate` can be loaded as a plugin using `use()`.\n\n```js\nconst md = require('markdown-it')()\n  .use(require('markdown-it-decorate'))\n```\n\n## Cheatsheet\n\nYou can add classes, ID's, or attributes. (See [§ Annotating elements](#annotating-elements))\n\n| Source | Output |\n|----|----|\n| `Text <!--{.center}-->` | `<p class='center'>Text</p>` |\n| `Text <!-- {.center} -->` | `<p class='center'>Text</p>` |\n| `# Hola <!-- {.center.red} -->` | `<h1 class='center red'>Hola</h1>` |\n| `# Hola <!-- {#top .hide} -->` | `<h1 id='top' class='hide'>Hola</h1>` |\n| `# Hola <!-- {data-show=\"true\"} -->` | `<h1 data-show='true'>Hola</h1>` |\n| `![Image](img.jpg)<!-- {width=20} -->` | `<img src='img.jpg' alt='Image' width='20'>` |\n\nYou can specify the element name to decorate. (See [§ Disambiguating](#disambiguating))\n\n| Source | Output |\n|----|----|\n| `# Hi *world* <!-- {.red} -->` | `<h1>Hi <em class='red'>world</em></h1>` |\n| `# Hi *world* <!-- {h1:.red} -->` | `<h1 class='red'>Hi <em>world</em></h1>` |\n| `# *Hi* *world* <!-- {em^1:.red} -->` | `<h1><em class='red'>Hi</em> <em>world</em></h1>` |\n\n## Annotating elements\n\nCreate an HTML comment in the format `<!-- {...} -->`, where `...` can be a `.class`, `#id`, `key=attr` or a combination of any of them. The spaces around `{}` are optional. Be sure to render markdownIt with `html: true` to enable parsing of `<!--{comments}-->`.\n\n```html\n<!--{.class}-->\n<!-- {.class} -->\n<!-- {.class1.class2} -->\n<!-- {.class1 .class2} -->\n<!-- {#id} -->\n<!-- {attr=\"val\"} -->\n```\n\nYou can put the comment in the same line or in the next. I recommend keeping it on a separate line, since this will make GitHub ignore it.\n\n```html\n# Hello! <!-- {.center} -->\n```\n\n```html\n# Hello!\n<!-- {.center} -->\n```\n\n## Disambiguating\n\nBy default, annotations will be applied to the deepest element preceding it. In the case below, `.wide` will be applied to the link (*\"Next\"*).\n\n```md\n> This is a blockquote\n>\n> * It has a list.\n> * You can specify tag names. [Next](#next)\n> <!-- {.wide} -->\n```\n\n### Specifying elements\n\nTo make it apply to a different element, precede your annotations with the tag name followed by a `:`.\n\n```md\n> * It has a list.\n> * You can specify tag names. [Next](#next) <!-- {li:.wide} -->\n```\n\n### Combining\n\nYou can combine them as you need. In this example, the link gets `.button`, the list item gets `.wide`, and the blockquote gets `.bordered`.\n\n```md\n> * [Continue](#continue)\n<!-- {a:.button} -->\n<!-- {li:.wide} -->\n<!-- {blockquote:.bordered} -->\n```\n\n```html\n<blockquote class=\"bordered\">\n  <ul>\n    <li class=\"wide\">\n      <a href=\"#continue\" class=\"button\">Continue</a>\n    </li>\n  </ul>\n</blockquote>\n```\n\n### Selecting same names\n\nTo go back to previous parent with the same name, add `^n` after the tag name, where `n` is how many levels deep to go back to. Using `^0` is the same as not specifying it at all. (This convention is taken from [gitrevisions](http://git-scm.com/docs/gitrevisions).)\n\n```md\n> > > targets 3rd quote <!--{blockquote:.wide}-->\n```\n\n```md\n> > > targets 2nd quote <!--{blockquote^1:.wide}-->\n```\n\n```md\n> > > targets 1st quote <!--{blockquote^2:.wide}-->\n```\n\n### Decorating code blocks\n\nYou can decorate code blocks. You may choose to decorate `pre`, `code`, or even both.\n\n    ```\n    return true;\n    ```\n    <!-- {code: .lang-javascript} -->\n\nIndented code blocks are only supported in markdown-it 7.x or later.\n\n```\n    // this is a code block\n    return true;\n\n<!-- {code: .lang-javascript} -->\n```\n\n## Prior art\n\n* This is initially based off of [arve0/markdown-it-attrs](https://github.com/arve0/markdown-it-attrs) which uses text to annotate blocks (eg, `{.class #id}`). markdown-it-attr's approach was based off of [Pandoc's header attributes](http://pandoc.org/README.html#extension-header_attributes).\n\n* [Maruku](http://maruku.rubyforge.org/) (Ruby Markdown parser) also allows for block-level attributes and classnames with its [meta-data syntax](http://maruku.rubyforge.org/proposal.html). The syntax is similar to PanDoc's syntax (`{: .class #id}`).\n\n* [Kramdown](http://kramdown.gettalong.org/) (Ruby markdown parser) also supports the same syntax, also with a colon (`{: .class #id}`).\n\n## Motivation\n\nmarkdown-it-decorate is inspired by the design of those features and improves on them:\n\n* Elements are marked via HTML comments; they'll be invisible to other Markdown parsers like GitHub's.\n* It supports inline elements in addition to block elements.\n\n## Thanks\n\n**markdown-it-decorate** © 2015+, Rico Sta. Cruz. Released under the [MIT] License.<br>\nAuthored and maintained by Rico Sta. Cruz with help from contributors ([list][contributors]).\n\n> [ricostacruz.com](http://ricostacruz.com) &nbsp;&middot;&nbsp;\n> GitHub [@rstacruz](https://github.com/rstacruz) &nbsp;&middot;&nbsp;\n> Twitter [@rstacruz](https://twitter.com/rstacruz)\n\n[MIT]: http://mit-license.org/\n[contributors]: http://github.com/rstacruz/markdown-it-decorate/contributors\n[markdown-it]: https://www.npmjs.com/package/markdown-it\n","publish_time":1483341285668,"_cnpm_publish_time":1483341285668,"dist-tags":{"latest":"1.2.2"}}