{
  "name": "mdx-prism-2",
  "version": "8.0.5",
  "description": "A fork from mdx-prism plugin to highlight code blocks in HTML with Prism and more",
  "repository": {
    "type": "git",
    "url": "https://github.com/raulfdm/mdx-prism-2"
  },
  "homepage": "https://github.com/raulfdm/mdx-prism-2#readme",
  "keywords": [
    "rehype",
    "rehype-plugin",
    "mdx-plugin",
    "mdx-plugin-2",
    "syntax-highlighting",
    "prism",
    "html"
  ],
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/raulfdm/mdx-prism-2"
  },
  "type": "module",
  "main": "./dist/cjs/mdx-prism-2.js",
  "module": "./dist/esm/mdx-prism-2.js",
  "exports": {
    ".": {
      "require": "./dist/cjs/mdx-prism-2.js",
      "default": "./dist/esm/mdx-prism-2.js"
    }
  },
  "types": "./dist/types/lib.d.ts",
  "files": [
    "dist"
  ],
  "dependencies": {
    "hast-util-to-string": "2.0.0",
    "parse-numeric-range": "1.3.0",
    "refractor": "4.4.0",
    "rehype": "12.0.1",
    "rehype-parse": "8.0.3",
    "unified": "10.1.1",
    "unist-util-filter": "4.0.0",
    "unist-util-visit": "4.1.0",
    "unist-util-visit-parents": "5.1.0"
  },
  "devDependencies": {
    "@babel/core": "7.17.5",
    "@babel/preset-env": "7.16.11",
    "@babel/preset-typescript": "7.16.7",
    "@typescript-eslint/eslint-plugin": "5.12.1",
    "@typescript-eslint/parser": "5.12.1",
    "esbuild": "0.14.23",
    "esbuild-plugin-d.ts": "1.1.0",
    "eslint": "8.9.0",
    "eslint-plugin-simple-import-sort": "7.0.0",
    "husky": "7.0.4",
    "jest": "27.5.1",
    "jest-serializer-html-string": "1.0.1",
    "prettier": "2.5.1",
    "pretty-quick": "3.1.3",
    "scripty": "2.0.0",
    "tslib": "2.3.1",
    "typescript": "4.5.5"
  },
  "scripty": {
    "path": "./scripts"
  },
  "scripts": {
    "build": "scripty",
    "dev": "scripty",
    "lint": "scripty",
    "test": "scripty"
  },
  "readme": "> Attention: This package is no longer maintained\n>\n> ⚠️ This is Fork from [`mdx-prism`](https://github.com/j0lv3r4/mdx-prism) which automate the release process. There are a few fixes that does not have a published version there.\n>\n> Maybe in the future I can delete this repository in favor of having a single but for now I need things a bit more professional.\n\n# mdx-prism-2\n\nThis is a fork of [@mapbox/rehype-prism](https://github.com/mapbox/rehype-prism) that adds line highlighting capabilities, e.g.:\n\n<img src=\"https://jolvera.dev/static/overreacted-code-snippet.jpg\" alt=\"Snippet of code from Dan Abramov&rsquo;s blog\"/>\n\n[rehype](https://github.com/wooorm/rehype) plugin to highlight code blocks in HTML with [Prism] (via [refractor]).\n\n(If you would like to highlight code blocks with [highlight.js](https://github.com/isagalaev/highlight.js), instead, check out [rehype-highlight](https://github.com/wooorm/rehype-highlight).)\n\n**Best suited for usage in Node.**\nIf you would like to perform syntax highlighting _in the browser_, you should look into [less heavy ways to use refractor](https://github.com/wooorm/refractor#browser).\n\n## Installation\n\n```bash\nnpm install mdx-prism-2\n```\n\n## API\n\n`rehype().use(rehypePrism, [options])`\n\nSyntax highlights `pre > code`.\nUnder the hood, it uses [refractor], which is a virtual version of [Prism].\n\nThe code language is configured by setting a `language-{name}` class on the `<code>` element.\nYou can use any [language supported by refractor].\n\nIf no `language-{name}` class is found on a `<code>` element, it will be skipped.\n\n### options\n\n| Parameter                 |                                         Type                                         |   Default    | Description                                                                                                                                                                                                         |\n| :------------------------ | :----------------------------------------------------------------------------------: | :----------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `ignoreMissing`           |                                      `boolean`                                       |   `false`    | By default, if `{name}` does not correspond to a [language supported by refractor] an error will be thrown. If you would like to silently skip `<code>` elements with invalid languages, set this option to `true`. |\n| `lineHighlight.component` | `string` ([HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)) |    `div`     | The HTML tag used to wrap the highlight line.                                                                                                                                                                       |\n| `lineHighlight.className` |                                       `string`                                       | `mdx-marker` | CSS class applied to highlight line.                                                                                                                                                                                |\n\n## Usage\n\nUse this package [as a rehype plugin](https://github.com/rehypejs/rehype/blob/master/doc/plugins.md#using-plugins).\n\nSome examples of how you might do that:\n\n```js\nconst rehype = require('rehype');\nconst mdxPrism = require('mdx-prism-2');\n\nrehype().use(mdxPrism).process(/* some html */);\n```\n\n```js\nconst rehype = require('rehype');\nconst mdxPrism = require('mdx-prism-2');\n\nrehype()\n  .use(mdxPrism, {\n    lineHighlight: {\n      component: 'span',\n      className: 'my-line-highlight-class',\n    },\n  })\n  .process(/* some html */);\n```\n\n```js\nconst unified = require('unified');\nconst rehypeParse = require('rehype-parse');\nconst mdxPrism = require('mdx-prism-2');\n\nunified().use(rehypeParse).use(mdxPrism).processSync(/* some html */);\n```\n\nIf you'd like to get syntax highlighting in Markdown, parse the Markdown (with remark-parse), convert it to rehype, then use this plugin.\n\n```js\nconst unified = require('unified');\nconst remarkParse = require('remark-parse');\nconst remarkRehype = require('remark-rehype');\nconst mdxPrism = require('mdx-prism-2');\n\nunified()\n  .use(remarkParse)\n  .use(remarkRehype)\n  .use(mdxPrism)\n  .process(/* some markdown */);\n```\n\n## FAQ\n\n<details>\n  <summary>Why does mdx-prism-2 copy the <code>language-</code> class to the <code>&lt;pre&gt;</code> tag?</summary>\n  \n  [Prism recommends](https://prismjs.com/#basic-usage) adding the `language-` class to the `<code>` tag like this:\n\n```html\n<pre><code class=\"language-css\">p { color: red }</code></pre>\n```\n\nIt bases this recommendation on the HTML5 spec. However, an undocumented behavior of their JavaScript is that, in the process of highlighting the code, they also copy the `language-` class to the `<pre>` tag:\n\n```html\n<pre\n  class=\"language-css\"\n><code class=\"language-css\"><span class=\"token selector\">p</span> <span class=\"token punctuation\">{</span> <span class=\"token property\">color</span><span class=\"token punctuation\">:</span> red <span class=\"token punctuation\">}</span></code></pre>\n```\n\nThis resulted in many [Prism themes](https://github.com/PrismJS/prism-themes) relying on this behavior by using CSS selectors like `pre[class*=\"language-\"]`. So in order for people using mdx-prism-2 to get the most out of these themes, we decided to do the same.\n\n</details>\n\n[prism]: http://prismjs.com/\n[refractor]: https://github.com/wooorm/refractor\n[language supported by refractor]: https://github.com/wooorm/refractor#syntaxes\n"
}