File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
extensions/markdown-language-features/src/languageFeatures/copyFiles Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ enum MediaKind {
17
17
Audio ,
18
18
}
19
19
20
+ const externalUriSchemes = [
21
+ 'http' ,
22
+ 'https' ,
23
+ ] ;
24
+
20
25
export const mediaFileExtensions = new Map < string , MediaKind > ( [
21
26
// Images
22
27
[ 'bmp' , MediaKind . Image ] ,
@@ -161,7 +166,12 @@ export function createUriListSnippet(
161
166
insertedLinkCount ++ ;
162
167
snippet . appendText ( '[' ) ;
163
168
snippet . appendPlaceholder ( escapeBrackets ( title ) || 'Title' , placeholderValue ) ;
164
- snippet . appendText ( `](${ escapeMarkdownLinkPath ( mdPath ) } )` ) ;
169
+ if ( externalUriSchemes . includes ( uri . scheme ) ) {
170
+ const uriString = uri . toString ( true ) ;
171
+ snippet . appendText ( `](${ uriString } )` ) ;
172
+ } else {
173
+ snippet . appendText ( `](${ escapeMarkdownLinkPath ( mdPath ) } )` ) ;
174
+ }
165
175
}
166
176
}
167
177
@@ -292,7 +302,6 @@ function escapeMarkdownLinkPath(mdPath: string): string {
292
302
293
303
function escapeBrackets ( value : string ) : string {
294
304
value = value . replace ( / [ \[ \] ] / g, '\\$&' ) ;
295
- // value = value.replace(/\r\n\r\n/g, '\n\n');
296
305
return value ;
297
306
}
298
307
You can’t perform that action at this time.
0 commit comments