0.6.0 • Published 10 months ago

remove-markdown v0.6.0

Weekly downloads
89,103
License
MIT
Repository
github
Last release
10 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@preserve-sdk/react@ruibaby/wikijoplin-plugin-note-statsjoplin-plugin-notelistpreviewjoplin-plugin-tags-generatorhubot-command-mapperimdone-corehugo-elasticsearchhugo-lunr-indexerhugo-lunr-mlhugo-lunr-zhhugo-lovelt-algoliahugo-lunrhugo-lunr-diasporahugo-lunr-easterhugo-algoliahugo-algolia-fixhugo-algolia2hugo-algolia2-1hugo-lunr-indexhubspell-simplifier-markdowngulp-remove-markdownhs-admingrommet-cms-content-blockshadshads-plantumlhelp-center-uilunr-hugomarkdown-search-indexmarkdown-descriptionmarkdown-post-parsermarkedpageladomdds@walkaway-project/elmstatic@vuepress/theme-blog@thenumber/itinerator-expo-components@topgroup/diginext@theguild/algolia@versaprotocol/pdfgen@vibe-flats/vibe-common@xapp/stentor-gbm@telios/telios-client-backendanchor-markdown-headerapiconnect-explorer@guild-docs/algolia@guild-docs/client@gtoio/vuepress-theme-gto@cristianps1988/ds-template@crisog/sourcecred@communi/chat-react@communi/editor@aldridged/docusaurus-plugin-lunrstudy-managerspignitesteemviz-2sourcecredsourcecred-gitcoin-demosourcecred-publish-testtysapi-admintutors-reader-libtypings2tldrawlignintrailpack-proxy-cart@celesta/vuepress-plugin-celestazenapi-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-journal
0.6.0

10 months ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.5

1 year ago

0.5.2

1 year 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

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.2

11 years ago

0.0.1

11 years ago