0.6.0 • Published 4 months ago

remove-markdown v0.6.0

Weekly downloads
89,103
License
MIT
Repository
github
Last release
4 months ago
  • default workflow

What is it?

remove-markdown is a node.js module that will remove (strip) Markdown formatting from text. Markdown formatting means pretty much anything that doesn’t look like regular text, like square brackets, asterisks etc.

When do I need it?

The 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.

Installation

npm install remove-markdown

Usage

const removeMd = require('remove-markdown');
const markdown = '# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
const plainText = removeMd(markdown); // plainText is now 'This is a heading\n\nThis is a paragraph with a link in it.'

You can also supply an options object to the function. Currently, the following options are supported:

const plainText = removeMd(markdown, {
  stripListLeaders: true , // strip list leaders (default: true)
  listUnicodeChar: '',     // char to insert instead of stripped list leaders (default: '')
  gfm: true                // support GitHub-Flavored Markdown (default: true)
  useImgAltText: true      // replace images with alt-text, if present (default: true)
});

Setting stripListLeaders to false will retain any list characters (*, -, +, (digit).).

TODO

PRs are very much welcome. Here are some ideas for future enhancements:

  • Allow the RegEx expressions to be customized per rule
  • Make the rules more robust, support more edge cases
  • Add more (comprehensive) tests

Credits

The code is based on Markdown Service Tools - Strip Markdown by Brett Terpstra.

Authors

Stian Grytøyr (original creator) zuchka (maintainer since 2023)

euaaaiocodybonney.comvulcan-cra-startercaptain-dashboardsglue-js-documentation-builder@nona-creative/semantic-release-latest-release-notessourcecred-for-samudaitealess-dashboard@infinitebrahmanuniverse/nolb-remo@paiondata/nextwiki@everything-registry/sub-chunk-2649fillout-shared-codewiznote-sdk-jswallet-appstrapi-admin-lightstac-componentvitepress-theme-celesta@docs-gov-sg/doc-theme-default@cristianps1988/ds-template@crisog/sourcecred@communi/chat-react@communi/editor@preserve-sdk/react@ruibaby/wikijoplin-plugin-note-statsjoplin-plugin-notelistpreviewjoplin-plugin-tags-generatorstudy-managerspignitesteemviz-2sourcecredsourcecred-gitcoin-demosourcecred-publish-testtysapi-admintutors-reader-libtypings2tldrawlignintrailpack-proxy-cart@aldridged/docusaurus-plugin-lunr@celesta/vuepress-plugin-celesta@dao-dao/statefulzenapi-adminvuepress-theme-ckyvuepress-theme-dogvuepress-theme-dvgamerrvuepress-theme-sidstraw-blogvuepress-plugin-feedvuepress-theme-britecorevuepress-theme-blog-enhancevuepress-theme-blog-kawarimidollvuepress-theme-blog-materialvuepress-theme-blog-vuetifyvuepress-theme-blogplusvuepress-theme-ajwivuepress-theme-asgarvuepress-theme-zerovuepress-plugin-auto-front-mattervuepress-plugin-autometavuepress-theme-journalvuepress-theme-kbvuepress-theme-minimalismvuepress-theme-liulivuepress-theme-mediumvuepress-theme-mediumishvuepress-theme-lemonvuepress-theme-paperunidoc@fiction/core@financial-times/g-components@gtoio/vuepress-theme-gto@guild-docs/client@guild-docs/algolia@foxythemes/hugo-lunr@hozz/sourcecred@elucidata/tilt@eimfach/elmstatic@gatsbyjs/gatsby-theme-website@frontender-magazine/article-builder@gautamarora/post@gd4ark/theme-blog@gd4ark/vuepress-theme-blog@krenaldi/learnstorybook-design-system-template@liplum/cli@micro-app/plugin-vuepress@mx-space/kami-design@nodata/action@emundo/emubot@empiricalrun/test-gen@factor/www@fabrix/spool-cart@factor/api@factor/site@factor/dep@mapbox/dr-ui@kapstr/strapi-admin@jsweb001/processmd@quantco/pnpm-licenses@radiantearth/stac-browser@redpoint.rocks/algolia@openagenda/agenda-docx
0.6.0

4 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.5.5

8 months ago

0.5.2

9 months ago

0.5.0

3 years ago

0.3.0

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

9 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago