'; }); html += ''; } /* Introduction */ if (a.intro) { html += '

' + nl2p(a.intro) + '

'; } /* Body - parse ## sections and --- dividers */ var sectionIdx = 0; var bodyLines = (a.body||'').split(' '); var currentBlock = []; bodyLines.forEach(function(line) { if (line.startsWith('## ')) { if (currentBlock.length) { html += '

' + nl2p(currentBlock.join(' ')) + '

'; currentBlock=[]; } html += '

'+esc2(line.replace(/^## /,''))+'

'; sectionIdx++; } else if (line === '---') { if (currentBlock.length) { html += '

' + nl2p(currentBlock.join(' ')) + '

'; currentBlock=[]; } html += '
'; } else { currentBlock.push(line); } }); if (currentBlock.length) html += '

' + nl2p(currentBlock.join(' ')) + '

'; /* Conclusion */ if (a.conclusion) { html += '

💡 Key Takeaways: ' + nl2p(a.conclusion) + '

'; } bodyEl.innerHTML = html; } } function nl2p(str) { return esc2(str).replace(/\n\n/g,'

').replace(/\n/g,'
'); } function esc2(s){ return String(s||'').replace(/&/g,'&').replace(//g,'>'); } function formatArtDate(d){ try{ return new Date(d).toLocaleDateString('en-IN',{day:'numeric',month:'long',year:'numeric'}); }catch(e){return d||'';} } const obs=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting)e.target.classList.add('visible');});},{threshold:0.06}); document.querySelectorAll('.fade-up').forEach(function(el){obs.observe(el);});