@@ -156,13 +156,15 @@ let rendered = null; // window.__RENDERED__
// Client transforms
//
function transform(html, mode) {
+ // Raw source view — escape HTML for display
if(mode==='raw') {
const e = html.replace(/&/g,'&').replace(//g,'>');
return '
'+e+''; } - // Modern, Gmail, Outlook — all render the same raw HTML. - // Use the dev server (go run . dev) with Juice CSS inlining - // for accurate email client simulation. + // Modern, Gmail, Outlook — all show the same rendered HTML. + // In dev mode (go run . dev), the server applies Juice CSS inlining + // before serving — the output is already email-optimised. + // In static mode, the notice bar warns that simulation is approximate. return html; } @@ -291,7 +293,7 @@ document.addEventListener('keydown',e=>{ document.getElementById('loading').style.display='none'; } else { - document.getElementById('loading').innerHTML = 'rendered.js not foundRun: cd tools && go run . preview all'; + document.getElementById('loading').innerHTML = '
rendered.js not found
Run: cd tools && go run . preview all
'; } render(); })(); @@ -305,7 +307,7 @@ document.addEventListener('keydown',e=>{ ws = new WebSocket(proto + '//' + location.host + '/ws'); } catch(e) { // static mode (file://) — WebSocket constructor throws - if (notice) notice.style.display = ''; + if (notice) notice.style.display = 'block'; return; } ws.onmessage = function(e) { @@ -329,11 +331,11 @@ document.addEventListener('keydown',e=>{ console.log('[dev] live-reload connected'); }; ws.onclose = function() { - if (notice) notice.style.display = ''; + if (notice) notice.style.display = 'block'; console.log('[dev] live-reload disconnected'); }; ws.onerror = function() { - if (notice) notice.style.display = ''; + if (notice) notice.style.display = 'block'; }; })();