Skip to content

Extracts plain text from Markdown strings. It's useful for Natural Language Processing (NLP) tasks.

License

Notifications You must be signed in to change notification settings

bent10/stopmarkdown

Repository files navigation

stopmarkdown

A utility for Node.js and the browser that extracts plain text from Markdown strings. It's useful for Natural Language Processing (NLP) tasks that require only the textual content of Markdown documents.

Install

npm install stopmarkdown

Or yarn:

yarn add stopmarkdown

Alternatively, you can also include this module directly in your HTML file from CDN:

UMD: https://cdn.jsdelivr.net/npm/stopmarkdown/dist/index.umd.js
ESM: https://cdn.jsdelivr.net/npm/stopmarkdown/+esm
CJS: https://cdn.jsdelivr.net/npm/stopmarkdown/dist/index.cjs

Usage

import stopmarkdown from 'stopmarkdown'

const markdownContent = `
# Heading 1

This is a paragraph with some *italic* and **bold** text.

- Item 1
- Item 2

## Heading 2

> Blockquote

\`\`\`js
console.log('Code block');
\`\`\`
`

const segments = stopmarkdown(markdownContent)
console.log(segments)

API

stopmarkdown(input: string): string[]

Returns an array of text segments extracted from the Markdown string.

  • input: The Markdown string to tokenize.

Related

  • boox – Performing full-text search across multiple documents by combining TF-IDF score with inverted index weight.
  • stophtml – Extracts plain text from an HTML string.
  • nomark – Transforms hypertext strings (e.g., HTML, Markdown) into plain text for natural language processing (NLP) normalization.
  • stopword – Allows you to strip stopwords from an input text (supports a ton of languages).

Contributing

We 💛  issues.

When committing, please conform to the semantic-release commit standards. Please install commitizen and the adapter globally, if you have not already.

npm i -g commitizen cz-conventional-changelog

Now you can use git cz or just cz instead of git commit when committing. You can also use git-cz, which is an alias for cz.

git add . && git cz

License

GitHub

A project by Stilearning © 2024.