Skip to content

Commit

Permalink
Merge branch 'main' into remove-unnecessary-escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
zuchka authored Aug 2, 2024
2 parents 810db18 + ee995d4 commit 38840a7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 28 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
![default workflow](https://github.com/stiang/remove-markdown/actions/workflows/default.yaml/badge.svg)

## *** 2022-10-18: Important message about the future of this package ***
Hello all, I don’t use this package in my own projects any longer and I have come to the realization that I basically don’t have the bandwidth to maintain the package.

However, the package is used quite a bit and I don’t want to just abandon it. So I’m looking for suggestions on how to move forward with someone else in charge of maintaining the package on a day-to-day basis. I’m open to adding collaborators to this repo or moving the entire repo to a more fitting home.

Please contact me directly or post a comment on [the issue I created about this](https://github.com/stiang/remove-markdown/issues/61) (#61).

## 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.
Expand Down Expand Up @@ -50,5 +43,6 @@ PRs are very much welcome. Here are some ideas for future enhancements:
## Credits
The code is based on [Markdown Service Tools - Strip Markdown](http://brettterpstra.com/2013/10/18/a-markdown-service-to-strip-markdown/) by Brett Terpstra.

## Author
Stian Grytøyr
## Authors
Stian Grytøyr (original creator)
[zuchka](https://github.com/zuchka) (maintainer since 2023)
13 changes: 13 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare module "remove-markdown" {
export function removeMd(md: string, options?: {
stripListLeaders?: boolean;
listUnicodeChar?: string;
gfm?: boolean;
useImgAltText: boolean;
abbr?: boolean;
replaceLinksWithURL?: boolean;
htmlTagsToSkip?: string[];
}): string;

export = removeMd;
}
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function(md, options) {
options.abbr = options.hasOwnProperty('abbr') ? options.abbr : false;
options.replaceLinksWithURL = options.hasOwnProperty('replaceLinksWithURL') ? options.replaceLinksWithURL : false;
options.htmlTagsToSkip = options.hasOwnProperty('htmlTagsToSkip') ? options.htmlTagsToSkip : [];
options.throwError = options.hasOwnProperty('throwError') ? options.throwError : false;

var output = md || '';

Expand Down Expand Up @@ -48,7 +49,7 @@ module.exports = function(md, options) {
htmlReplaceRegex = new RegExp(
'<' +
joinedHtmlTagsToSkip +
'[^>]*>',
'[^>]*>',
'ig'
);
}
Expand Down Expand Up @@ -89,7 +90,9 @@ module.exports = function(md, options) {
// Replace strike through
.replace(/~(.*?)~/g, '$1');
} catch(e) {
console.error(e);
if (options.throwError) throw e;

console.error("remove-markdown encountered error: %s", e);
return md;
}
return output;
Expand Down
28 changes: 15 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "remove-markdown",
"version": "0.5.0",
"version": "0.5.1",
"description": "Remove Markdown formatting from text",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha -R spec test/remove-markdown.js"
},
"repository": {
"type": "git",
"url": "https://github.com/stiang/remove-markdown.git"
"url": "https://github.com/zuchka/remove-markdown.git"
},
"keywords": [
"markdown"
],
"author": "Stian Grytøyr",
"license": "MIT",
"bugs": {
"url": "https://github.com/stiang/remove-markdown/issues"
"url": "https://github.com/zuchka/remove-markdown/issues"
},
"homepage": "https://github.com/stiang/remove-markdown",
"homepage": "https://github.com/zuchka/remove-markdown",
"devDependencies": {
"chai": "^4.0.2",
"mocha": "^10.2.0",
Expand Down

0 comments on commit 38840a7

Please sign in to comment.