strip-markdown Strip Markdown syntax to plain text
Examples
Strip Markdown formatting to plain text
Usage
"# Hello World
This is **bold** and *italic*.
```js
console..." | strip-markdown Convert Markdown notes to plain text for an email
Usage
"# Meeting Notes
**Action items:**
- [ ] Review *budget*
- [..." | strip-markdown Remove Markdown formatting from AI-generated study notes
Usage
"## Chapter 1
The **quick** brown fox *jumped* over the `laz..." | strip-markdown View source
(input)=>{
let out = input;
out = out.replace(/^(`{3,}|~{3,})[^\n]*\n([\s\S]*?)^\1\s*$/gm, "$2");
out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
out = out.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1");
out = out.replace(/`([^`]+)`/g, "$1");
out = out.replace(/\*\*(.+?)\*\*/g, "$1");
out = out.replace(/\*(.+?)\*/g, "$1");
out = out.replace(/~~(.+?)~~/g, "$1");
out = out.replace(/^#{1,6}\s+/gm, "");
out = out.replace(/^>\s?/gm, "");
out = out.replace(/^[-*_]{3,}\s*$/gm, "");
out = out.replace(/\[[ xX]\]\s+/gm, "");
return out;
}