Skip to content

Commit 67b5b2f

Browse files
authored
Merge pull request #266239 from mjbvz/dev/mjbvz/release-notes-fix
Fix TOC in release notes
2 parents e35b84f + eb1f08c commit 67b5b2f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/vs/workbench/contrib/update/browser/releaseNotesEditor.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,21 @@ export class ReleaseNotesManager extends Disposable {
265265
private async renderBody(fileContent: { text: string; base: URI }) {
266266
const nonce = generateUuid();
267267

268-
const content: { toString: () => string } = await renderMarkdownDocument(fileContent.text, this._extensionService, this._languageService, {
268+
// Remove HTML comment markers around table of contents navigation
269+
const rawFileContent = fileContent.text
270+
.replace(/<!--\s*TOC\s*/gi, '')
271+
.replace(/\s*Navigation End\s*-->/gi, '');
272+
273+
const processedContent: { toString: () => string } = await renderMarkdownDocument(rawFileContent, this._extensionService, this._languageService, {
269274
sanitizerConfig: {
270275
allowedMediaProtocols: {
271276
override: '*' // TODO: remove once we can use <base> to find real resource locations
272277
},
273278
allowedLinkProtocols: {
274279
override: [Schemas.http, Schemas.https, Schemas.command]
280+
},
281+
allowedTags: {
282+
augment: ['nav']
275283
}
276284
},
277285
markedExtensions: [{
@@ -282,12 +290,6 @@ export class ReleaseNotesManager extends Disposable {
282290
}]
283291
});
284292

285-
// Remove HTML comment markers around table of contents navigation
286-
const processedContent = content
287-
.toString()
288-
.replace(/<!--\s*TOC\s*/gi, '')
289-
.replace(/\s*Navigation End\s*-->/gi, '');
290-
291293
const colorMap = TokenizationRegistry.getColorMap();
292294
const css = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
293295
const showReleaseNotes = Boolean(this._configurationService.getValue<boolean>('update.showReleaseNotes'));

0 commit comments

Comments
 (0)