Skip to content

Commit

Permalink
Re #134853. Support html headers in notebook outline
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Sep 7, 2022
1 parent 50140a5 commit deb6a94
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,17 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
entries.push(new OutlineEntry(entries.length, token.depth, cell, renderMarkdownAsPlaintext({ value: token.text }).trim(), false, false));
}
}
if (!hasHeader) {
// no markdown syntax headers, try to find html tags
const match = fullContent.match(/<h([1-6]).*>(.*)<\/h\1>/i);
if (match) {
hasHeader = true;
const level = parseInt(match[1]);
const text = match[2].trim();
entries.push(new OutlineEntry(entries.length, level, cell, text, false, false));
}
}

if (!hasHeader) {
content = renderMarkdownAsPlaintext({ value: content });
}
Expand Down

0 comments on commit deb6a94

Please sign in to comment.