mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 17:49:19 +02:00
Initial work
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
1b0acc5547
commit
6d3d416f58
5 changed files with 15 additions and 9 deletions
|
@ -36,17 +36,17 @@ export function createExcerpt(fileString: string): string | undefined {
|
|||
// Remove HTML tags.
|
||||
.replace(/<[^>]*>/g, '')
|
||||
// Remove Title headers
|
||||
.replace(/^\#\s*([^#]*)\s*\#?/gm, '')
|
||||
.replace(/^#\s*([^#]*)\s*#?/gm, '')
|
||||
// Remove Markdown + ATX-style headers
|
||||
.replace(/^\#{1,6}\s*([^#]*)\s*(\#{1,6})?/gm, '$1')
|
||||
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
|
||||
// Remove emphasis and strikethroughs.
|
||||
.replace(/([\*_~]{1,3})(\S.*?\S{0,1})\1/g, '$2')
|
||||
.replace(/([*_~]{1,3})(\S.*?\S{0,1})\1/g, '$2')
|
||||
// Remove images.
|
||||
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
||||
.replace(/!\[(.*?)\][[(].*?[\])]/g, '$1')
|
||||
// Remove footnotes.
|
||||
.replace(/\[\^.+?\](\: .*?$)?/g, '')
|
||||
.replace(/\[\^.+?\](: .*?$)?/g, '')
|
||||
// Remove inline links.
|
||||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
||||
.replace(/\[(.*?)\][[(].*?[\])]/g, '$1')
|
||||
// Remove inline code.
|
||||
.replace(/`(.+?)`/g, '$1')
|
||||
// Remove blockquotes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue