Update Core.js
This commit is contained in:
parent
f444ae5735
commit
0428c0d37f
1 changed files with 14 additions and 9 deletions
7
Core.js
7
Core.js
|
|
@ -34,7 +34,10 @@ class SimonUp {
|
|||
}
|
||||
}
|
||||
|
||||
// Phase 1: Blöcke und Inline-Strukturen parsen (sammelt auch alle Überschriften)
|
||||
html = this._parseBlocks(html);
|
||||
|
||||
// Phase 2: Das Inhaltsverzeichnis nachträglich in die vorbereitete Box einsetzen
|
||||
html = this._injectTOC(html);
|
||||
|
||||
if (this.plugins && this.plugins.length > 0) {
|
||||
|
|
@ -126,6 +129,7 @@ class SimonUp {
|
|||
const intro = lines.map(function(l) { return self._parseInline(l); }).join('<br>');
|
||||
tocWrapper += `<p class="toc-intro">${intro}</p>\n`;
|
||||
}
|
||||
// HIER IST JETZT DER ECHTE PLATZHALTER:
|
||||
tocWrapper += '\n';
|
||||
tocWrapper += '</div>';
|
||||
return tocWrapper;
|
||||
|
|
@ -270,7 +274,7 @@ class SimonUp {
|
|||
const numStr = self._getAutoNumber(level);
|
||||
const fullTitle = `${numStr} ${title}`;
|
||||
const id = self._slugify(fullTitle);
|
||||
self.headings.push({ level: level, text: fullTitle, id: id });
|
||||
self.headings.push({ level: level, text: title, id: id }); // Speichert nur den puren Titel ohne Nummer für das TOC Link-Markup
|
||||
return `<h${level} id="${id}">${fullTitle}</h${level}>${rest}`;
|
||||
});
|
||||
|
||||
|
|
@ -331,6 +335,7 @@ class SimonUp {
|
|||
* INTERN: Erzeugt die fertige HTML-Liste des TOC und injiziert sie in den Block
|
||||
*/
|
||||
_injectTOC(html) {
|
||||
// HIER STEHT JETZT DEFINITIV DAS RECHTE TOKEN:
|
||||
const placeholder = '';
|
||||
|
||||
if (!html.includes(placeholder)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue