{"_id":"@slorber/remark-comment","_rev":"3267427","name":"@slorber/remark-comment","description":"Remark plugin to support comments","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"slorber","email":""}],"time":{"modified":"2024-03-21T09:59:07.000Z","created":"2023-06-23T17:01:14.116Z","1.0.0":"2023-06-23T17:01:14.116Z"},"users":{},"author":{"name":"Lee Byron","email":"lee@leebyron.com","url":"https://leebyron.com"},"repository":{"type":"git","url":"git+https://github.com/leebyron/remark-comment.git"},"versions":{"1.0.0":{"name":"@slorber/remark-comment","version":"1.0.0","description":"Remark plugin to support comments","author":{"name":"Lee Byron","email":"lee@leebyron.com","url":"https://leebyron.com"},"license":"MIT","keywords":["unified","remark","remark-plugin","plugin","mdast","markdown","comment"],"repository":{"type":"git","url":"git+https://github.com/leebyron/remark-comment.git"},"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"micromark-factory-space":"^1.0.0","micromark-util-character":"^1.1.0","micromark-util-symbol":"^1.0.1"},"scripts":{"test":"cd test && npm install --no-package-lock && npm test"},"gitHead":"f496b9d500d9cafd684d0d458c93ad1be5fd930f","bugs":{"url":"https://github.com/leebyron/remark-comment/issues"},"homepage":"https://github.com/leebyron/remark-comment#readme","_id":"@slorber/remark-comment@1.0.0","_nodeVersion":"18.16.1","_npmVersion":"9.7.1","dist":{"shasum":"2a020b3f4579c89dec0361673206c28d67e08f5a","size":3385,"noattachment":false,"key":"/@slorber/remark-comment/-/@slorber/remark-comment-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@slorber/remark-comment/download/@slorber/remark-comment-1.0.0.tgz"},"_npmUser":{"name":"slorber","email":"lorber.sebastien@gmail.com"},"directories":{},"maintainers":[{"name":"slorber","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-comment_1.0.0_1687539673952_0.7529466595361334"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-06-23T17:01:14.116Z","publish_time":1687539674116,"_source_registry_name":"default","_cnpm_publish_time":1687539674116}},"readme":"# remark-comment\n\nParse HTML style comments as a different node type so it can be ignored during\nserialization.\n\n## Install and usage\n\n```sh\nnpm install remark-comment\n```\n\n```js\nimport { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkComment from 'remark-comment'\n\nunified().use(remarkParse).use(remarkComment)\n```\n\nFor more help with unified, please see the docs for [unified] and [remark].\n\nThis package also exports its [micromark] and [mdast] plugins:\n\n```js\nimport {\n  comment,\n  commentHtml,\n  commentFromMarkdown,\n  commentToMarkdown,\n} from 'remark-comment'\n```\n\n**Options:**\n\nThe `remarkComment` and `commentFromMarkdown` functions take the options:\n\n- `ast`: If true, a `{ type: \"comment\" }` node will be included in the\n  resulting AST. This is useful if you want to do post-processing and stringify\n  back to markdown. Default: `false`.\n\n[unified]: https://unifiedjs.com/learn/guide/using-unified/\n[remark]: https://unifiedjs.com/explore/package/remark-parse/\n[micromark]: https://github.com/micromark/micromark\n[mdast]: https://github.com/syntax-tree/mdast#extensions\n\n## Example\n\n```markdown\n# This file\n\n<!-- contains a comment -->\n\nAnd a paragraph\n```\n\nRenders to:\n\n```html\n<h1>This file</h1>\n<p>And a paragraph</p>\n```\n\n## Motivation\n\nThis package was created after realizing that MDX lacked support for HTML style\ncomments. When trying to migrate an existing collection of markdown files to\nMDX, hitting syntax errors for HTML comments was a non-starter. Rather than go\nmodify all those files to use a (more awkward) JSX expression comment, I created\nthis plugin to add back this support.\n\nHowever, I found this useful when used outside of MDX. Common markdown\ninterprets an HTML comment as an HTML block, and during serialization will pass\nit directly through to the final HTML document. I typically do not want my\nmarkdown comments appearing in my final HTML documents, and this plugin achieves\nthis effect.\n\n## Caveats\n\nThis plugin must be added after MDX, otherwise you will see this error:\n\n```\nUnexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a comment in MDX, use `{/* text */}`)\n```\n\nIn a unified pipeline:\n\n```js\nunified().use(remarkMDX).use(remarkComment)\n```\n\nUnlike HTML, comments cannot be used within a JSX body. JSX is still JSX.\nHTML comments must appear outside of JSX, use JSX style comments (`{/* comment */}`) inside of JSX.\n","_attachments":{},"homepage":"https://github.com/leebyron/remark-comment#readme","bugs":{"url":"https://github.com/leebyron/remark-comment/issues"},"license":"MIT"}