Created
February 28, 2023 19:29
-
-
Save Angelfire/e770ca31a72a9e827fe076951c08dbf0 to your computer and use it in GitHub Desktop.
Raw Markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rawMarkdown(markdown) { | |
const regex = /(\*{1,2}|_{1,2}|`{1,3}|~{1,2}|#{1,6}|!{0,1}\[.*?\]\(.*?\)|>{1}|`{1,2}|!\[.*?\]\(.*?\))/g | |
const noMarkdown = markdown.replace(regex, '') | |
return noMarkdown | |
} | |
const markdown = ` | |
# H1 | |
## H2 | |
### H3 | |
#### H4 | |
##### H5 | |
###### H6 | |
> Blockquote | |
\`\`\` | |
const code = 'hello world'; | |
console.log(code); | |
\`\`\` | |
[Link to example.com](https://www.example.com) | |
## Paragraph | |
`; | |
const plainText = rawMarkdown(markdown); | |
console.log(plainText); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment