{"_id":"@elboman/remark-jsx","_rev":"1-1cc98d4e55bcbf37ef4682ba5ba73fd5","name":"@elboman/remark-jsx","description":"[![npm version](https://img.shields.io/npm/v/@elboman/remark-jsx.svg?style=flat-square)](https://www.npmjs.com/package/@elboman/remark-jsx) [![MIT licence](https://img.shields.io/github/license/elboman/remark-jsx.svg?style=flat-square)](license)","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@elboman/remark-jsx","version":"0.1.0","main":"lib/index.js","license":"MIT","dependencies":{"mdast-util-to-hast":"^3.0.0","remark-parse":"^5.0.0","unist-util-map":"^1.0.3"},"devDependencies":{"@babel/cli":"^7.0.0-beta.39","@babel/core":"^7.0.0-beta.39","@babel/plugin-proposal-object-rest-spread":"^7.0.0-beta.39","@babel/preset-env":"^7.0.0-beta.39","jest":"^22.1.4","prettier":"^1.10.2","shx":"^0.2.2","unified":"^6.1.6"},"scripts":{"test":"jest --watchAll","clean":"shx rm -rf lib","compile":"babel src --out-dir lib --ignore '**/__tests__/**'","build":"yarn clean && yarn compile","prepublishOnly":"npm run build"},"gitHead":"6fb04652a6eddc2e8c9dadb83f8afd9cc875918c","description":"[![npm version](https://img.shields.io/npm/v/@elboman/remark-jsx.svg?style=flat-square)](https://www.npmjs.com/package/@elboman/remark-jsx) [![MIT licence](https://img.shields.io/github/license/elboman/remark-jsx.svg?style=flat-square)](license)","_id":"@elboman/remark-jsx@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.3.0","_npmUser":{"name":"elboman","email":"marco.botto@gmail.com"},"dist":{"integrity":"sha512-oRJFS3NpMMf2I2VjvJAqNN/hk4iwsdEuLzfxRRwV8Wxj27Kdihfyw43cCtTRRp6zLDbRhi6UJirTo1ESXucw4Q==","shasum":"72065c1c77c359d1f21e498638e95d1c824b37b5","tarball":"https://registry.npmjs.org/@elboman/remark-jsx/-/remark-jsx-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtsxCUpXmhFgCg1yV3u08uVJ6As6R57p4v57vXNiZ90wIhANylmcMAafAAY0hTdbICD8Xlmpq0YvADcIv2nlsemgWo"}]},"maintainers":[{"name":"elboman","email":"marco.botto@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-jsx-0.1.0.tgz_1517752730448_0.2621124635916203"}}},"readme":"# @elboman/remark-jsx\n\n[![npm version](https://img.shields.io/npm/v/@elboman/remark-jsx.svg?style=flat-square)](https://www.npmjs.com/package/@elboman/remark-jsx)\n[![MIT licence](https://img.shields.io/github/license/elboman/remark-jsx.svg?style=flat-square)](license)\n\nAdd support for JSX custom components in [**remark**][remark] markdown using a whitelist of Elements. They are parsed along with their props to be rendered later with React or any framework of that sort.\n\n> NB: This package is a fork of [@dumpster/remark-custom-element-to-hast](https://github.com/fazouane-marouane/remark-jsx/tree/master/packages/remark-custom-element-to-hast) created in order to enhance JSX parsing to support expressions, converted code to ES6 syntax and updated the test suit with more comprehensive tests.\n\n## Getting started\n\n```jsx\nimport unified from 'unified';\nimport remark from 'remark-parse';\nimport remarkJsx from '@elboman/remark-jsx';\n\nconst processor = unified()\n  .use(parseMD)\n  .use(remarkJsx, {\n    componentWhitelist: ['CustomComponent'],\n  });\n\nconst output = processor.processSync(\n  `# Hello World\n<CustomComponent withProps={'somestring'} />\n<CustomComponent someExpression={15 + 32} />\n`\n);\n```\n\nThe above example will output:\n\n```json\n{\n  \"type\": \"root\",\n  \"children\": [\n    {\n      \"type\": \"element\",\n      \"tagName\": \"h1\",\n      \"properties\": {},\n      \"children\": [\n        {\n          \"type\": \"text\",\n          \"value\": \"Hello World\"\n        }\n      ]\n    },\n    {\n      \"type\": \"element\",\n      \"tagName\": \"CustomComponent\",\n      \"properties\": {\n        \"withProps\": {\n          \"value\": \"somestring\",\n          \"type\": \"string\"\n        }\n      },\n      \"children\": []\n    },\n    {\n      \"type\": \"element\",\n      \"tagName\": \"CustomComponent\",\n      \"properties\": {\n        \"someExpression\": {\n          \"value\": \"15+32\",\n          \"type\": \"expression\"\n        }\n      },\n      \"children\": []\n    }\n  ]\n}\n```\n\n[remark]: https://github.com/wooorm/remark\n[license]: /LICENSE\n","maintainers":[{"name":"elboman","email":"marco.botto@gmail.com"}],"time":{"modified":"2022-04-05T07:07:16.014Z","created":"2018-02-04T13:58:50.526Z","0.1.0":"2018-02-04T13:58:50.526Z"},"license":"MIT","readmeFilename":"README.md"}