{"_id":"@1build/remark-slate","_rev":"1-16083af43cfc2e95878e8dba2c62b78a","name":"@1build/remark-slate","dist-tags":{"latest":"1.5.1-b.1"},"versions":{"1.5.1-b.1":{"name":"@1build/remark-slate","version":"1.5.1-b.1","description":"remark plugin to compile Markdown to a slate compatible object","license":"MIT","module":"dist/remark-slate.esm.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","lint":"tsdx lint","prepare":"tsdx build","pub":"npm publish --access public"},"main":"dist/index.js","typings":"dist/index.d.ts","keywords":["remark","remark-plugin","plugin","mdast","markdown","slate","RTE","text editor"],"repository":{"type":"git","url":"git+https://github.com/1build/remark-slate.git"},"bugs":{"url":"https://github.com/1build/remark-slate/issues"},"author":{"name":"Jack Hanford","email":"jackhanford@gmail.com","url":"https://jackhanford.com"},"contributors":[{"name":"Jack Hanford","email":"jackhanford@gmail.com","url":"https://jackhanford.com"},{"name":"Horacio Herrera","email":"hi@horacioh.com","url":"https://horacioh.com"},{"name":"Michael Darr","email":"michael@1build.com","url":"https://michaeldarr.github.io"}],"dependencies":{"@types/escape-html":"^1.0.0","escape-html":"^1.0.3"},"devDependencies":{"eslint-plugin-prettier":"^3.1.3","husky":"^4.2.5","jest":"^25.2.4","prettier":"^2.0.0","remark":"^13.0.0","remark-parse":"^9.0.0","tsdx":"^0.13.2","tslib":"^2.0.0","typescript":"^4.2.2","unified":"^9.0.0"},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"homepage":"https://github.com/1build/remark-slate#readme","directories":{"test":"test"},"gitHead":"68b252b9a91d45931be581a23fb24d3f5d5c172c","_id":"@1build/remark-slate@1.5.1-b.1","_nodeVersion":"15.11.0","_npmVersion":"7.6.1","dist":{"integrity":"sha512-iz9iCRUXKlODA9rbQbm4BMUkmfeV1eztnbR+ySchgtDZwiHGhaI/aKh5rKngafDL0O6j17qDoo6EfXjDYB1C4A==","shasum":"dbdcbd02db5afb12371ab398ccbb9d65c42aeb31","tarball":"https://registry.npmjs.org/@1build/remark-slate/-/remark-slate-1.5.1-b.1.tgz","fileCount":17,"unpackedSize":124077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQZR3CRA9TVsSAnZWagAA1fMP/RgxCAEkaeIX1N78W3gK\nQOonk0qQ4MtJdK8IdWZTOpadcnX64XUf7cgccnZNSzF49a99LmiOEU36tRt9\ne8mPrUxJrNKzQo/eB8YwIPke5R4omO4//bHKHK3iRdQAPzJHqV3B8oUcJT3A\nZ3fG4oUumzBWEBLAeijGFuWfIXWI0AajxIiKt5ghIker2px6vyRm+ap5fgFJ\n6eHp4Zouq2u4VCzbgMyFz7NvayqmlnUUaINHiyTW3FylRvhTu1LNdK64EyOu\naWM2pdTUz3AuvrliTc+35ruVqnCIU+NrZqmqXqCv/2qHZwjp1SIIIwq6ZpnL\nAMIvTjvksbdM0LmyeKE8WmZOyb1rfmaVLoc0fzllRt/+jJCknGHFMTytj3O/\nYHwABJF5KOBsfwdpr4h3aj+qloYt2Eyh949y8CLyhM51jphslbbPG39tBGOh\nIKadC2S9GgXV7vl7PZQ+thyEgZqHoTsL7LhY0vkhIRTB4GG+pubN2fCkAH0P\nSCgbghOBTAOSV2fBxLoApS6lotxcWflysmyBf+3Qp8poPXFjWJtKDrqpG4LR\n7iZLLsJqwT666wM2GX0p8DogAwtOa2xd99A6uCDqhhSQDyUQ8OuviMHLNOpO\nbqR3K5yqSFzW+r1tGObbgpeeqlpVeQPDwLHdBRlh+RluB3tiRH6TU+PGFx8I\nYf0x\r\n=keko\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICLEAk8SGBhkiIhA9Ni6SOo6PUcV7CZa7B/7N7rzeWmvAiABJWSyQjORdyV9JUVA5t8G139tEeEUkMjgccyxwwU3ew=="}]},"_npmUser":{"name":"1build","email":"accounts@1build.com"},"maintainers":[{"name":"1build","email":"accounts@1build.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-slate_1.5.1-b.1_1614910583215_0.8238461378046147"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-05T02:16:23.171Z","1.5.1-b.1":"2021-03-05T02:16:23.364Z","modified":"2022-04-04T10:32:45.759Z"},"maintainers":[{"name":"1build","email":"accounts@1build.com"}],"description":"remark plugin to compile Markdown to a slate compatible object","homepage":"https://github.com/1build/remark-slate#readme","keywords":["remark","remark-plugin","plugin","mdast","markdown","slate","RTE","text editor"],"repository":{"type":"git","url":"git+https://github.com/1build/remark-slate.git"},"contributors":[{"name":"Jack Hanford","email":"jackhanford@gmail.com","url":"https://jackhanford.com"},{"name":"Horacio Herrera","email":"hi@horacioh.com","url":"https://horacioh.com"},{"name":"Michael Darr","email":"michael@1build.com","url":"https://michaeldarr.github.io"}],"author":{"name":"Jack Hanford","email":"jackhanford@gmail.com","url":"https://jackhanford.com"},"bugs":{"url":"https://github.com/1build/remark-slate/issues"},"license":"MIT","readme":"# remark-slate\n\n> Transform the contents of a slate 0.50+ editor into markdown and back again.\n\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\n[**remark**][remark] plugin to compile Markdown as a [Slate](https://www.slatejs.org/) 0.50+ compatible object.\n\n## Usage\n\n### Serializing from slate object to markdown:\n\n`remark-slate` exports an opinionated `serialize` function that is meant to be invoked with a `slate 0.50+` state object and will transform the object into a markdown document.\n\n```js\nimport { serialize } from 'remark-slate';\n\nexport default ({ onChange }) => {\n  const [value, setValue] = useState(initialValue);\n\n  React.useEffect(() => {\n    // serialize slate state to a markdown string\n    onChange(value.map((v) => serialize(v)).join(''));\n  }, [onChange, value]);\n\n  return (\n    <Slate editor={editor} value={value} onChange={(value) => setValue(value)}>\n      <Editable\n        renderElement={renderElement}\n        renderLeaf={renderLeaf}\n        placeholder=\"Enter some rich text…\"\n        ...\n      />\n      ...\n    </Slate>\n  );\n};\n```\n\n### Deserializing from markdown to slate object:\n\nWhen deserializing, this package is meant to be used with [remark-parse](https://github.com/remarkjs/remark/tree/master/packages/remark-parse)\n\nSay we have the following file, `example.md`:\n\n```markdown\n# Heading one\n\n## Heading two\n\n### Heading three\n\n#### Heading four\n\n##### Heading five\n\n###### Heading six\n\nNormal paragraph\n\n_italic text_\n\n**bold text**\n\n~~strike through text~~\n\n[hyperlink](https://jackhanford.com)\n\n> A block quote.\n\n- bullet list item 1\n- bullet list item 2\n\n1. ordered list item 1\n1. ordered list item 2\n```\n\nAnd our script, `example.js`, looks as follows:\n\n```js\nimport fs from 'fs';\nimport unified from 'unified';\nimport markdown from 'remark-parse';\nimport slate from 'remark-slate';\n\nunified()\n  .use(markdown)\n  .use(slate)\n  .process(fs.readFileSync('example.md'), (err, file) => {\n    if (err) throw err;\n    console.log({ file });\n  });\n```\n\nWould result in the following:\n\n```json\n[\n  {\n    \"type\": \"heading_one\",\n    \"children\": [\n      {\n        \"text\": \"Heading one\"\n      }\n    ]\n  },\n  {\n    \"type\": \"heading_two\",\n    \"children\": [\n      {\n        \"text\": \"Heading two\"\n      }\n    ]\n  },\n  {\n    \"type\": \"heading_three\",\n    \"children\": [\n      {\n        \"text\": \"Heading three\"\n      }\n    ]\n  },\n  {\n    \"type\": \"heading_four\",\n    \"children\": [\n      {\n        \"text\": \"Heading four\"\n      }\n    ]\n  },\n  {\n    \"type\": \"heading_five\",\n    \"children\": [\n      {\n        \"text\": \"Heading five\"\n      }\n    ]\n  },\n  {\n    \"type\": \"heading_six\",\n    \"children\": [\n      {\n        \"text\": \"Heading six\"\n      }\n    ]\n  },\n  {\n    \"type\": \"paragraph\",\n    \"children\": [\n      {\n        \"text\": \"Normal paragraph\"\n      }\n    ]\n  },\n  {\n    \"type\": \"paragraph\",\n    \"children\": [\n      {\n        \"text\": \"italic text\",\n        \"italic\": true\n      }\n    ]\n  },\n  {\n    \"type\": \"paragraph\",\n    \"children\": [\n      {\n        \"text\": \"bold text\",\n        \"italic\": true\n      }\n    ]\n  },\n  {\n    \"type\": \"paragraph\",\n    \"children\": [\n      {\n        \"text\": \"strike through text\",\n        \"strikeThrough\": true\n      }\n    ]\n  },\n  {\n    \"type\": \"paragraph\",\n    \"children\": [\n      {\n        \"type\": \"link\",\n        \"link\": \"https://jackhanford.com\",\n        \"children\": [\n          {\n            \"text\": \"hyperkink\"\n          }\n        ]\n      }\n    ]\n  },\n  {\n    \"type\": \"block_quote\",\n    \"children\": [\n      {\n        \"type\": \"paragraph\",\n        \"children\": [\n          {\n            \"text\": \"A block quote.\"\n          }\n        ]\n      }\n    ]\n  },\n  {\n    \"type\": \"ul_list\",\n    \"children\": [\n      {\n        \"type\": \"list_item\",\n        \"children\": [\n          {\n            \"type\": \"paragraph\",\n            \"children\": [\n              {\n                \"text\": \"bullet list item 1\"\n              }\n            ]\n          }\n        ]\n      },\n      {\n        \"type\": \"list_item\",\n        \"children\": [\n          {\n            \"type\": \"paragraph\",\n            \"children\": [\n              {\n                \"text\": \"bullet list item 2\"\n              }\n            ]\n          }\n        ]\n      }\n    ]\n  },\n  {\n    \"type\": \"ol_list\",\n    \"children\": [\n      {\n        \"type\": \"list_item\",\n        \"children\": [\n          {\n            \"type\": \"paragraph\",\n            \"children\": [\n              {\n                \"text\": \"ordered list item 1\"\n              }\n            ]\n          }\n        ]\n      },\n      {\n        \"type\": \"list_item\",\n        \"children\": [\n          {\n            \"type\": \"paragraph\",\n            \"children\": [\n              {\n                \"text\": \"ordered list item 2\"\n              }\n            ]\n          }\n        ]\n      }\n    ]\n  }\n]\n```\n\n```js\n{\n  type: 'heading',\n  depth: 1,\n  children: [{ value: 'Big text' }]\n}\n```\n\n…would yield:\n\n```json\n{\n  \"type\": \"heading_one\",\n  \"children\": [{ \"text\": \"Big text\" }]\n}\n```\n\n## Local Development\n\nBelow is a list of commands you will probably find useful.\n\n### `npm start` or `yarn start`\n\nRuns the project in development/watch mode. The project will be rebuilt upon changes.\n\nYour library will be rebuilt if you make edits.\n\n### `npm run build` or `yarn build`\n\nBundles the package to the `dist` folder.\nThe package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).\n\n### `npm test` or `yarn test`\n\nRuns the test watcher (Jest) in an interactive mode.\nBy default, runs tests related to files changed since the last commit.\n\n## License (MIT)\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\n\nCopyright © 2020-present [Jack Hanford](http://jackhanford.com), jackhanford@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n<!-- Definitions -->\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-slate.svg\n[downloads]: https://www.npmjs.com/package/remark-slate\n[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-slate.svg\n[size]: https://bundlephobia.com/result?p=remark-slate\n[remark]: https://github.com/remarkjs/remark\n","readmeFilename":"README.md"}