File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ export function preprocess(content: string): string {
94
94
. replace ( / ! \[ ( .* ?) \] \( .* ?\) / g, "$1" )
95
95
// Remove links but keep text
96
96
. replace ( / \[ ( .* ?) \] \( .* ?\) / g, "$1" )
97
+ // Simplify URLs: remove protocol and simplify to domain+path
98
+ . replace ( / ( h t t p s ? : \/ \/ ) ? ( w w w \. ) ? ( [ ^ \s ] + \. [ ^ \s ] + ) / g, "$3" )
99
+ // Remove Discord mentions specifically
100
+ . replace ( / < @ [ ! & ] ? \d + > / g, "" )
97
101
// Remove HTML tags
98
102
. replace ( / < [ ^ > ] * > / g, "" )
99
103
// Remove horizontal rules
@@ -105,10 +109,8 @@ export function preprocess(content: string): string {
105
109
. replace ( / \s + / g, " " )
106
110
// Remove multiple newlines
107
111
. replace ( / \n { 3 , } / g, "\n\n" )
108
- // strip all special characters
109
- . replace ( / [ ^ a - z A - Z 0 - 9 \s ] / g, "" )
110
- // Remove Discord mentions
111
- . replace ( / < @ ! ? \d + > / g, "" )
112
+ // Remove special characters except those common in URLs
113
+ . replace ( / [ ^ a - z A - Z 0 - 9 \s \- _ . / : ? = & ] / g, "" )
112
114
. trim ( )
113
115
. toLowerCase ( )
114
116
) ;
You can’t perform that action at this time.
0 commit comments