We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
# ...
1 parent ecdacba commit 7d29df9Copy full SHA for 7d29df9
āsrc/toc.ts
@@ -223,8 +223,10 @@ function buildToc() {
223
let toc;
224
let editor = vscode.window.activeTextEditor;
225
if (isMdEditor(editor)) {
226
- toc = editor.document.getText().split(/\r?\n/g)
227
- .filter(lineText => lineText.startsWith('#') && !lineText.toLowerCase().includes('<!-- omit in toc -->'))
+ toc = editor.document.getText()
+ .replace(/(^|\r?\n)```[\W\w]+?(```|$)/g, '') // Remove code blocks
228
+ .split(/\r?\n/g)
229
+ .filter(lineText => lineText.startsWith('#') && lineText.includes('# ') && !lineText.toLowerCase().includes('<!-- omit in toc -->'))
230
.map(lineText => {
231
let entry = {};
232
let matches = /^(#+) (.*)/.exec(lineText);
0 commit comments