@@ -85,7 +85,7 @@ export const markdownItWikilinkEmbed = (
85
85
md
86
86
) ;
87
87
refsStack . pop ( ) ;
88
- return content ;
88
+ return refsStack . length === 0 ? md . render ( content ) : content ;
89
89
} catch ( e ) {
90
90
Logger . error (
91
91
`Error while including ${ wikilinkItem } into the current document of the Preview panel` ,
@@ -105,7 +105,7 @@ function getNoteContent(
105
105
md : markdownit
106
106
) : string {
107
107
let content = `Embed for [[${ includedNote . uri . path } ]]` ;
108
- let html : string ;
108
+ let toRender : string ;
109
109
110
110
switch ( includedNote . type ) {
111
111
case 'note' : {
@@ -126,7 +126,7 @@ function getNoteContent(
126
126
: cardFormatter ;
127
127
128
128
content = extractor ( includedNote , parser , workspace ) ;
129
- html = formatter ( content , md ) ;
129
+ toRender = formatter ( content , md ) ;
130
130
break ;
131
131
}
132
132
case 'attachment' :
@@ -135,19 +135,19 @@ function getNoteContent(
135
135
${ md . renderInline ( '[[' + includedNote . uri . path + ']]' ) } <br/>
136
136
Embed for attachments is not supported
137
137
</div>` ;
138
- html = md . render ( content ) ;
138
+ toRender = md . render ( content ) ;
139
139
break ;
140
140
case 'image' :
141
141
content = `<div class="embed-container-image">${ md . render (
142
142
` } )`
143
143
) } </div>`;
144
- html = md . render ( content ) ;
144
+ toRender = md . render ( content ) ;
145
145
break ;
146
146
default :
147
- html = content ;
147
+ toRender = content ;
148
148
}
149
149
150
- return html ;
150
+ return toRender ;
151
151
}
152
152
153
153
function withLinksRelativeToWorkspaceRoot (
@@ -271,13 +271,11 @@ function contentExtractor(
271
271
export type EmbedNoteFormatter = ( content : string , md : markdownit ) => string ;
272
272
273
273
function cardFormatter ( content : string , md : markdownit ) : string {
274
- return md . render (
275
- `<div class="embed-container-note">${ md . render ( content ) } </div>`
276
- ) ;
274
+ return `<div class="embed-container-note">\n\n${ content } \n\n</div>` ;
277
275
}
278
276
279
277
function inlineFormatter ( content : string , md : markdownit ) : string {
280
- return md . render ( content ) ;
278
+ return content ;
281
279
}
282
280
283
281
export default markdownItWikilinkEmbed ;
0 commit comments