diff --git a/Core.js b/Core.js index 24743d9..75e60fa 100644 --- a/Core.js +++ b/Core.js @@ -1,5 +1,5 @@ /** - * SimonUp Core Compiler (Core.js) - Version 1.2 + * SimonUp Core Compiler (Core.js) - Version 1.2.1 * Eine moderne, fluss- und blockorientierte Auszeichnungssprache. */ class SimonUp { @@ -129,7 +129,6 @@ class SimonUp { const intro = lines.map(function(l) { return self._parseInline(l); }).join('
'); tocWrapper += `

${intro}

\n`; } - // Ein Text-Token, das garantiert nicht vom Browser unsichtbar gemacht wird: tocWrapper += 'STRENG_GEHEIMER_TOC_PLATZHALTER\n'; tocWrapper += ''; return tocWrapper; @@ -224,10 +223,16 @@ class SimonUp { html = html.replace(/\/\/(( \s|$))/g, '$1'); - // 1. ZUERST: Standard Text-Inline-Rules parsen + // 1. ZUERST: Die kritischen Doppel-Sterne (fett) verarbeiten + html = html.replace(/\*\*(.+?)\\\*\*/g, '$1'); + html = html.replace(/\*\*(.+?)(?=\*\*|$)/g, '$1'); + + // 2. DANACH: Das einzelne Sternchen (medium) separat behandeln, damit es keine Tags beschädigt + html = html.replace(/\*(.+?)\\\*/g, '$1'); + html = html.replace(/\*(.+?)(?=\*|$)/g, '$1'); + + // 3. Restliche Standard Text-Inline-Rules parsen const inlineRules = [ - { tag: 'strong', symbol: '\\*\\*' }, - { tag: 'span style="font-weight: 500;"', symbol: '\\*' }, { tag: 'em', symbol: '%' }, { tag: 'u', symbol: '_' }, { tag: 'del', symbol: '~' }, @@ -248,7 +253,7 @@ class SimonUp { html = html.replace(resetRegex, `<${rule.tag}>$1`); } - // 2. DANACH: Überschriften generieren (schützt generierte id="" Attribute vor den Regeln oben) + // 4. Überschriften generieren let self = this; const processHeading = function(pattern, callback) { let match; @@ -288,7 +293,7 @@ class SimonUp { return `${title}${rest}`; }); - // 3. RESTLICHE STRUKTUREN (Ausrichtungen, Links, Medien) + // 5. RESTLICHE STRUKTUREN (Ausrichtungen, Links, Medien) const alignMap = { 'l': 'left', 'r': 'right', 'c': 'center', 'j': 'justify' }; html = html.replace(/>([lrcj])\s+(.+?)\s*\/>/g, function(m, dir, content) { return `
${content}
`; @@ -335,7 +340,6 @@ class SimonUp { * INTERN: Erzeugt die fertige HTML-Liste des TOC und injiziert sie in den Block */ _injectTOC(html) { - // Jetzt als absolut lesbarer, unmissverständlicher Text-String! const placeholder = 'STRENG_GEHEIMER_TOC_PLATZHALTER'; if (!html.includes(placeholder)) {