remove comments from full code blocks for outline
This commit is contained in:
parent
3c03935ff4
commit
4499d6ff09
|
|
@ -1182,9 +1182,9 @@ function noteApp() {
|
||||||
const lines = content.split('\n');
|
const lines = content.split('\n');
|
||||||
const slugCounts = {}; // Track duplicate slugs
|
const slugCounts = {}; // Track duplicate slugs
|
||||||
|
|
||||||
// Skip frontmatter
|
// Skip frontmatter and code blocks
|
||||||
let inFrontmatter = false;
|
let inFrontmatter = false;
|
||||||
let frontmatterEnded = false;
|
let inCodeBlock = false;
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
const line = lines[i];
|
const line = lines[i];
|
||||||
|
|
@ -1197,11 +1197,19 @@ function noteApp() {
|
||||||
if (inFrontmatter) {
|
if (inFrontmatter) {
|
||||||
if (line.trim() === '---') {
|
if (line.trim() === '---') {
|
||||||
inFrontmatter = false;
|
inFrontmatter = false;
|
||||||
frontmatterEnded = true;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle fenced code blocks (``` or ~~~)
|
||||||
|
if (line.trim().startsWith('```') || line.trim().startsWith('~~~')) {
|
||||||
|
inCodeBlock = !inCodeBlock;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (inCodeBlock) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Match heading lines (# to ######)
|
// Match heading lines (# to ######)
|
||||||
const match = line.match(/^(#{1,6})\s+(.+)$/);
|
const match = line.match(/^(#{1,6})\s+(.+)$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue