{"name":"remove-markdown","version":"0.6.2","keywords":["markdown"],"author":{"name":"Stian Grytøyr"},"license":"MIT","_id":"remove-markdown@0.6.2","maintainers":[{"name":"stiang","email":"stian@grytoyr.net"},{"name":"zuchka","email":"zuchka@pm.me"}],"homepage":"https://github.com/zuchka/remove-markdown","bugs":{"url":"https://github.com/zuchka/remove-markdown/issues"},"dist":{"shasum":"8e6a8d1b148569cc4df0404b60b0a42fb49840b5","tarball":"http://registry-npm.ywwl.com/remove-markdown/download/remove-markdown-0.6.2.tgz","fileCount":7,"integrity":"sha512-EijDXJZbzpGbQBd852ViUzcqgpMujthM+SAEHiWCMcZonRbZ+xViWKLJA/vrwbDwYdxrs1aFDjpBhcGrZoJRGA==","signatures":[{"sig":"MEUCIQCAzjD0yC8U0DpKi2Kb8heYErtV0BsjMHsD/S6KyG0bagIgJjVIwPrknrrnC5ExI4g2UeN2oqQbPF6xZ3zPUWxEOgk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20285,"size":5824,"noattachment":false,"key":"/remove-markdown/-/remove-markdown-0.6.2.tgz"},"main":"index.js","types":"./index.d.ts","gitHead":"e1b46bc28f6bd00490819b4f68bb69a51ca7a187","scripts":{"test":"mocha -R spec test/remove-markdown.js"},"_npmUser":{"name":"zuchka","email":"zuchka@pm.me"},"repository":{"url":"git+https://github.com/zuchka/remove-markdown.git","type":"git"},"_npmVersion":"10.8.1","description":"Remove Markdown formatting from text","directories":{},"_nodeVersion":"22.4.1","_hasShrinkwrap":false,"devDependencies":{"chai":"^4.0.2","mocha":"^10.2.0","should":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/remove-markdown_0.6.2_1746146307677_0.8220728862783451","host":"s3://npm-registry-packages-npm-production"},"readme":"[![npm version](https://img.shields.io/npm/v/remove-markdown.svg)](https://www.npmjs.com/package/remove-markdown)\n[![npm downloads](https://img.shields.io/npm/dm/remove-markdown.svg)](https://npm-compare.com/remove-markdown/#timeRange=THREE_YEARS)\n[![GitHub Actions Build Status](https://github.com/zuchka/remove-markdown/actions/workflows/default.yaml/badge.svg)](https://github.com/zuchka/remove-markdown/actions/workflows/default.yaml)\n\n## What is it?\n**remove-markdown** is a JavaScript module that removes (strips) Markdown formatting from text. It supports CommonJS and ES modules in Node.js, plus Deno through npm compatibility.\n*Markdown formatting* means pretty much anything that doesn’t look like regular text, like square brackets, asterisks etc.\n\n## When do I need it?\nThe typical use case is to display an excerpt from some Markdown text, without any of the actual Markdown syntax - for example in a list of posts.\n\n## Installation\n\n```sh\nnpm install remove-markdown\n```\n\n## Usage\n\n### CommonJS\n\n```js\nconst removeMd = require('remove-markdown');\nconst markdown = '# This is a heading\\n\\nThis is a paragraph with [a link](http://www.disney.com/) in it.';\nconst plainText = removeMd(markdown); // plainText is now 'This is a heading\\n\\nThis is a paragraph with a link in it.'\n```\n\n### Node.js ES modules\n\n```js\nimport removeMd from 'remove-markdown';\n\nconst markdown = '# This is a heading\\n\\nThis is a paragraph with [a link](http://www.disney.com/) in it.';\nconst plainText = removeMd(markdown);\n```\n\n### Browser ES modules\n\nThe ESM entry is self-contained and can be loaded directly from a CDN that\nserves JavaScript with the correct MIME type. Pin the URL to the version you\nhave tested:\n\n```html\n<script type=\"module\">\n  import removeMd from 'https://unpkg.com/remove-markdown@0.7.1/index.mjs';\n\n  const plainText = removeMd('# This is a heading');\n</script>\n```\n\n### Deno\n\n```js\nimport removeMd from 'npm:remove-markdown@^0.7.1';\n\nconst markdown = '# This is a heading\\n\\nThis is a paragraph with [a link](http://www.disney.com/) in it.';\nconst plainText = removeMd(markdown);\n```\n\nDeno support is provided through the npm package; there is no separate JSR package. The package exposes one callable default export in every runtime. Named exports and direct imports from raw GitHub URLs, which do not reliably serve the correct JavaScript MIME type, are not supported.\n\nYou can also supply an options object to the function. Currently, the following options are supported:\n\n```js\nconst plainText = removeMd(markdown, {\n  stripListLeaders: true ,     // strip list leaders (default: true)\n  listUnicodeChar: '',         // char to insert instead of stripped list leaders (default: '')\n  gfm: true,                   // support GitHub-Flavored Markdown (default: true)\n  useImgAltText: true,         // replace images with alt-text, if present (default: true)\n  abbr: true,                  // remove abbreviations, if present (default: false)\n  replaceLinksWithURL: true,   // remove inline links, if present (default: false)\n  separateLinksAndTexts: ': ', // replace inline links with text, separator and link, if present (default: null)\n  htmlTagsToSkip: ['a', 'b'],  // HTML tags to skip, if present (default: [])\n  throwError: false,           // throw errors instead of catching and logging (default: false)\n});\n```\n\nSetting `stripListLeaders` to false will retain any list characters (`*, -, +, (digit).`).\n\n## TODO\nPRs are very much welcome. Here are some ideas for future enhancements:\n\n* Allow the RegEx expressions to be customized per rule\n* Make the rules more robust, support more edge cases\n* Add more (comprehensive) tests\n\n## Credits\nThe code is based on [Markdown Service Tools - Strip Markdown](http://brettterpstra.com/2013/10/18/a-markdown-service-to-strip-markdown/) by Brett Terpstra.\n\n## Authors\nStian Grytøyr (original creator)\n[zuchka](https://github.com/zuchka) (maintainer since 2023)\n","publish_time":1746146307871,"_cnpm_publish_time":1746146307871,"dist-tags":{"latest":"0.8.0","next":"0.7.0-rc.1"}}