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 {
1717 Audio ,
1818}
1919
20+ const externalUriSchemes = [
21+ 'http' ,
22+ 'https' ,
23+ ] ;
24+
2025export const mediaFileExtensions = new Map < string , MediaKind > ( [
2126 // Images
2227 [ 'bmp' , MediaKind . Image ] ,
@@ -161,7 +166,12 @@ export function createUriListSnippet(
161166 insertedLinkCount ++ ;
162167 snippet . appendText ( '[' ) ;
163168 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+ }
165175 }
166176 }
167177
@@ -292,7 +302,6 @@ function escapeMarkdownLinkPath(mdPath: string): string {
292302
293303function escapeBrackets ( value : string ) : string {
294304 value = value . replace ( / [ \[ \] ] / g, '\\$&' ) ;
295- // value = value.replace(/\r\n\r\n/g, '\n\n');
296305 return value ;
297306}
298307
You can’t perform that action at this time.
0 commit comments