Update Core.js

This commit is contained in:
simonpipe 2026-07-07 21:19:13 +02:00
parent 9b27907b04
commit 6c7d721de3

View file

@ -197,13 +197,13 @@ class SimonUp {
const id = this._slugify(fullTitle); const id = this._slugify(fullTitle);
this.headings.push({ level: lvl, text: fullTitle, id: id }); this.headings.push({ level: lvl, text: fullTitle, id: id });
return `<h${lvl} id="${id}" style="display:inline-block; margin-right:10px;">${fullTitle}</h${lvl}>${rest}`; return '<h' + lvl + ' id="' + id + '" style="display:inline-block; margin-right:10px;">' + fullTitle + '</h' + lvl + '>' + rest;
}); });
// Regel B: Vom TOC ausgeschlossene Titel (3#- Titel 3#- Restlicher Text) // Regel B: Vom TOC ausgeschlossene Titel (3#- Titel 3#- Restlicher Text)
html = html.replace(/([1-6])#-\s*([^#]+?)\s*\1#-(.*)/g, (match, level, title, rest) => { html = html.replace(/([1-6])#-\s*([^#]+?)\s*\1#-(.*)/g, (match, level, title, rest) => {
const lvl = parseInt(level); const lvl = parseInt(level);
return `<h${lvl} style="display:inline-block; margin-right:10px;">${title.trim()}</h${lvl}>${rest}`; return '<h' + lvl + ' style="display:inline-block; margin-right:10px;">' + title.trim() + '</h' + lvl + '>' + rest;
}); });
// Regel C: Manuelle Nummerierung (3# Titel 3# Restlicher Text) // Regel C: Manuelle Nummerierung (3# Titel 3# Restlicher Text)
@ -212,14 +212,14 @@ class SimonUp {
const id = this._slugify(title.trim()); const id = this._slugify(title.trim());
this.headings.push({ level: lvl, text: title.trim(), id: id }); this.headings.push({ level: lvl, text: title.trim(), id: id });
return `<h${lvl} id="${id}" style="display:inline-block; margin-right:10px;">${title.trim()}</h${lvl}>${rest}`; return '<h' + lvl + ' id="' + id + '" style="display:inline-block; margin-right:10px;">' + title.trim() + '</h' + lvl + '>' + rest;
}); });
// Regel D: Das schnelle, solitäre # für H1 (# Titel # Restlicher Text) // Regel D: Das schnelle, solitäre # für H1 (# Titel # Restlicher Text)
html = html.replace(/#([^#]+)#(.*)/g, (match, title, rest) => { html = html.replace(/#([^#]+)#(.*)/g, (match, title, rest) => {
const id = this._slugify(title.trim()); const id = this._slugify(title.trim());
this.headings.push({ level: 1, text: title.trim(), id: id }); this.headings.push({ level: 1, text: title.trim(), id: id });
return `<h1 id="${id}" style="display:inline-block; margin-right:10px;">${title.trim()}</h1>${rest}`; return '<h1 id="' + id + '" style="display:inline-block; margin-right:10px;">' + title.trim() + '</h1>' + rest;
}); });
// 3. STANDARD FLUSS-FORMATIERUNGEN (In priorisierter Reihenfolge) // 3. STANDARD FLUSS-FORMATIERUNGEN (In priorisierter Reihenfolge)