在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):stiang/remove-markdown开源软件地址(OpenSource Url):https://github.com/stiang/remove-markdown开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):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
Usageconst 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 TODOPRs are very much welcome. Here are some ideas for future enhancements:
CreditsThe code is based on Markdown Service Tools - Strip Markdown by Brett Terpstra. AuthorStian Grytøyr |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论