@@ -576,17 +576,15 @@ export class ExtensionEditor extends BaseEditor {
576576
577577 private async openMarkdown ( cacheResult : CacheResult < string > , noContentCopy : string , template : IExtensionEditorTemplate ) : Promise < IActiveElement > {
578578 try {
579- const contents = await this . loadContents ( ( ) => cacheResult , template ) ;
580- const content = await renderMarkdownDocument ( contents , this . extensionService , this . modeService ) ;
581- const documentContent = await this . renderBody ( content ) ;
582- const body = removeEmbeddedSVGs ( documentContent ) ;
579+ const body = await this . renderMarkdown ( cacheResult , template ) ;
583580
584581 const webviewElement = this . contentDisposables . add ( this . webviewService . createWebviewEditorOverlay ( 'extensionEditor' , {
585582 enableFindWidget : true ,
586583 } , { } ) ) ;
587584
588585 webviewElement . claim ( this ) ;
589586 webviewElement . layoutWebviewOverElement ( template . content ) ;
587+ webviewElement . html = body ;
590588
591589 this . contentDisposables . add ( webviewElement . onDidFocus ( ( ) => this . fireOnDidFocus ( ) ) ) ;
592590 const removeLayoutParticipant = arrays . insert ( this . layoutParticipants , {
@@ -597,7 +595,6 @@ export class ExtensionEditor extends BaseEditor {
597595 } ) ;
598596
599597 this . contentDisposables . add ( toDisposable ( removeLayoutParticipant ) ) ;
600- webviewElement . html = body ;
601598
602599 this . contentDisposables . add ( webviewElement . onDidClickLink ( link => {
603600 if ( ! link ) {
@@ -618,6 +615,13 @@ export class ExtensionEditor extends BaseEditor {
618615 }
619616 }
620617
618+ private async renderMarkdown ( cacheResult : CacheResult < string > , template : IExtensionEditorTemplate ) {
619+ const contents = await this . loadContents ( ( ) => cacheResult , template ) ;
620+ const content = await renderMarkdownDocument ( contents , this . extensionService , this . modeService ) ;
621+ const documentContent = await this . renderBody ( content ) ;
622+ return removeEmbeddedSVGs ( documentContent ) ;
623+ }
624+
621625 private async renderBody ( body : string ) : Promise < string > {
622626 const nonce = generateUuid ( ) ;
623627 const colorMap = TokenizationRegistry . getColorMap ( ) ;
0 commit comments