<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Most | Son The Nguyen</title><link>https://www.sonthenguyen.com/mosttheblog/</link><atom:link href="https://www.sonthenguyen.com/mosttheblog/index.xml" rel="self" type="application/rss+xml"/><description>Most</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><image><url>https://www.sonthenguyen.com/media/icon_hu_3b813cb9d022ad4f.png</url><title>Most</title><link>https://www.sonthenguyen.com/mosttheblog/</link></image><item><title>Response Engineering for Training-Free Alignment of LLMs</title><link>https://www.sonthenguyen.com/mosttheblog/response-engineering-for-training-free-alignment-of-llms/</link><pubDate>Tue, 11 Aug 2026 18:00:00 +0000</pubDate><guid>https://www.sonthenguyen.com/mosttheblog/response-engineering-for-training-free-alignment-of-llms/</guid><description>&lt;p&gt;This hands-on tutorial explores response engineering techniques that improve
language-model outputs at inference time, including Best-of-N selection,
self-consistency, Reflexion, and Mixture-of-Agents.&lt;/p&gt;
&lt;p&gt;This notebook was developed and curated by Son The Nguyen for the NAIRR 2026
Training-Free Alignment of LLMs tutorial.&lt;/p&gt;
&lt;div class="notebook-resource-badges not-prose" aria-label="Notebook resources"&gt;
&lt;a href="https://github.com/sonthenguyen/alignment" aria-label="View the source repository on GitHub"&gt;
&lt;img
src="https://img.shields.io/badge/GitHub-View_source-181717?logo=github&amp;amp;logoColor=white"
alt="View source on GitHub"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;a href="https://colab.research.google.com/github/sonthenguyen/alignment/blob/main/response_engineering_for_training_free_alignment.ipynb" aria-label="Open the notebook in Google Colab"&gt;
&lt;img
src="https://colab.research.google.com/assets/colab-badge.svg"
alt="Open in Colab"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;div class="static-notebook-embed not-prose"&gt;
&lt;iframe
id="static-notebook-0fd176e281e4bed62bc68eb92ccf190a"
class="static-notebook-frame"
data-src="https://www.sonthenguyen.com/notebooks/response-engineering-training-free-alignment/"
title="Response Engineering Tutorial Notebook"
loading="eager"
allowtransparency="true"
sandbox="allow-scripts allow-same-origin"
&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;script&gt;
(() =&gt; {
const frame = document.getElementById("static-notebook-0fd176e281e4bed62bc68eb92ccf190a");
if (!frame) return;
const resize = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const height = Math.max(
doc.documentElement.scrollHeight,
doc.body ? doc.body.scrollHeight : 0
);
if (height) frame.style.height = `${height}px`;
};
const syncTheme = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const dark = document.documentElement.classList.contains('dark');
const hostStyle = window.getComputedStyle(document.body);
const hostBackground = hostStyle.backgroundColor;
const hostBackgroundImage = hostStyle.backgroundImage;
const hostForeground = window.getComputedStyle(document.body).color;
const transparentHost = hostBackground === 'rgba(0, 0, 0, 0)' || hostBackground === 'transparent';
const base = transparentHost ? (dark ? '#111d4a' : '#fff8f0') : hostBackground;
const notebookBackground = hostBackgroundImage &amp;&amp; hostBackgroundImage !== 'none'
? `${hostBackgroundImage}, ${base}`
: base;
doc.documentElement.dataset.hbTheme = dark ? 'dark' : 'light';
doc.documentElement.style.setProperty('--notebook-page-bg', notebookBackground);
doc.documentElement.style.setProperty('--notebook-page-fg', hostForeground);
doc.documentElement.style.setProperty(
'--notebook-border',
`color-mix(in srgb, ${hostForeground} 24%, transparent)`
);
doc.documentElement.style.setProperty(
'--notebook-inline-bg',
`color-mix(in srgb, ${hostBackground} 76%, ${hostForeground} 24%)`
);
doc.documentElement.style.setProperty(
'--notebook-code-bg',
`color-mix(in srgb, ${hostBackground} 68%, black 32%)`
);
frame.style.background = notebookBackground;
};
const initialize = () =&gt; {
const doc = frame.contentDocument;
if (doc &amp;&amp; !doc.getElementById('hugo-notebook-theme')) {
const style = doc.createElement('style');
style.id = 'hugo-notebook-theme';
style.textContent = `
html, body {
background: var(--notebook-page-bg) !important;
color: var(--notebook-page-fg) !important;
}
main, #notebook, #notebook-container {
background: transparent !important;
color: var(--notebook-page-fg) !important;
}
#notebook-container {
box-shadow: none !important;
}
html[data-hb-theme="dark"] body,
html[data-hb-theme="dark"] .rendered_html,
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_area pre,
html[data-hb-theme="dark"] .output_subarea {
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html code {
border: 1px solid var(--notebook-border) !important;
background: var(--notebook-inline-bg) !important;
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .rendered_html pre {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .input_area {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
}
html[data-hb-theme="dark"] .prompt {
color: #60a5fa !important;
}
html[data-hb-theme="dark"] .input_area pre,
html[data-hb-theme="dark"] .input_area code,
html[data-hb-theme="dark"] .highlight {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .highlight .c,
html[data-hb-theme="dark"] .highlight .ch,
html[data-hb-theme="dark"] .highlight .cm,
html[data-hb-theme="dark"] .highlight .c1,
html[data-hb-theme="dark"] .highlight .cs {
color: #94a3b8 !important;
font-style: italic;
}
html[data-hb-theme="dark"] .highlight .k,
html[data-hb-theme="dark"] .highlight .kc,
html[data-hb-theme="dark"] .highlight .kd,
html[data-hb-theme="dark"] .highlight .kn,
html[data-hb-theme="dark"] .highlight .kp,
html[data-hb-theme="dark"] .highlight .kr,
html[data-hb-theme="dark"] .highlight .kt,
html[data-hb-theme="dark"] .highlight .ow {
color: #f472b6 !important;
}
html[data-hb-theme="dark"] .highlight .s,
html[data-hb-theme="dark"] .highlight .sa,
html[data-hb-theme="dark"] .highlight .sb,
html[data-hb-theme="dark"] .highlight .sc,
html[data-hb-theme="dark"] .highlight .dl,
html[data-hb-theme="dark"] .highlight .sd,
html[data-hb-theme="dark"] .highlight .s1,
html[data-hb-theme="dark"] .highlight .s2,
html[data-hb-theme="dark"] .highlight .se,
html[data-hb-theme="dark"] .highlight .sh,
html[data-hb-theme="dark"] .highlight .si,
html[data-hb-theme="dark"] .highlight .sx,
html[data-hb-theme="dark"] .highlight .sr,
html[data-hb-theme="dark"] .highlight .ss {
color: #fde68a !important;
}
html[data-hb-theme="dark"] .highlight .m,
html[data-hb-theme="dark"] .highlight .mb,
html[data-hb-theme="dark"] .highlight .mf,
html[data-hb-theme="dark"] .highlight .mh,
html[data-hb-theme="dark"] .highlight .mi,
html[data-hb-theme="dark"] .highlight .mo,
html[data-hb-theme="dark"] .highlight .il {
color: #c4b5fd !important;
}
html[data-hb-theme="dark"] .highlight .nb,
html[data-hb-theme="dark"] .highlight .bp {
color: #67e8f9 !important;
}
html[data-hb-theme="dark"] .highlight .nc,
html[data-hb-theme="dark"] .highlight .nf,
html[data-hb-theme="dark"] .highlight .nn {
color: #86efac !important;
}
html[data-hb-theme="dark"] .highlight .n,
html[data-hb-theme="dark"] .highlight .na,
html[data-hb-theme="dark"] .highlight .nd,
html[data-hb-theme="dark"] .highlight .ne,
html[data-hb-theme="dark"] .highlight .ni,
html[data-hb-theme="dark"] .highlight .nl,
html[data-hb-theme="dark"] .highlight .no,
html[data-hb-theme="dark"] .highlight .nt,
html[data-hb-theme="dark"] .highlight .nv,
html[data-hb-theme="dark"] .highlight .nx,
html[data-hb-theme="dark"] .highlight .py,
html[data-hb-theme="dark"] .highlight .p,
html[data-hb-theme="dark"] .highlight .o {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_subarea,
html[data-hb-theme="dark"] .output_area pre {
background: transparent !important;
}
html[data-hb-theme="dark"] .output_stderr {
background: #3f1d25 !important;
color: #fecdd3 !important;
}
html[data-hb-theme="dark"] .rendered_html table,
html[data-hb-theme="dark"] .rendered_html tr,
html[data-hb-theme="dark"] .rendered_html th,
html[data-hb-theme="dark"] .rendered_html td {
border-color: var(--notebook-border) !important;
background: transparent !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html tr:nth-child(2n) {
background: rgba(255, 255, 255, 0.035) !important;
}
html[data-hb-theme="dark"] .rendered_html a {
color: #93c5fd !important;
}
html[data-hb-theme="dark"] .rendered_html hr {
border-color: var(--notebook-border) !important;
}
`;
doc.head.appendChild(style);
}
syncTheme();
resize();
window.requestAnimationFrame(() =&gt; {
frame.classList.add('is-ready');
});
const body = frame.contentDocument &amp;&amp; frame.contentDocument.body;
if (body &amp;&amp; 'ResizeObserver' in window) {
new ResizeObserver(resize).observe(body);
}
window.setTimeout(resize, 500);
window.setTimeout(resize, 1500);
};
frame.addEventListener('load', initialize);
frame.src = frame.dataset.src;
window.addEventListener('pageshow', () =&gt; {
const doc = frame.contentDocument;
const href = frame.contentWindow &amp;&amp; frame.contentWindow.location.href;
if (doc &amp;&amp; doc.readyState === 'complete' &amp;&amp; href &amp;&amp; href !== 'about:blank') {
initialize();
}
});
window.addEventListener('resize', resize);
new MutationObserver(syncTheme).observe(document.documentElement, {
attributes: true,
attributeFilter: ['class']
});
})();
&lt;/script&gt;</description></item><item><title>Guided Decoding for Training-Free Alignment of LLMs</title><link>https://www.sonthenguyen.com/mosttheblog/guided-decoding-for-training-free-alignment-of-llms/</link><pubDate>Tue, 11 Aug 2026 17:00:00 +0000</pubDate><guid>https://www.sonthenguyen.com/mosttheblog/guided-decoding-for-training-free-alignment-of-llms/</guid><description>&lt;p&gt;This hands-on tutorial introduces inference-time methods for aligning language
model behavior without modifying model weights. It begins with standard decoding
strategies, including greedy decoding, beam search, temperature sampling, and
top-k/top-p sampling, and then develops guided decoding with custom logits
processors.&lt;/p&gt;
&lt;p&gt;This notebook was developed and curated by Son The Nguyen for the NAIRR 2026
Training-Free Alignment of LLMs tutorial.&lt;/p&gt;
&lt;div class="notebook-resource-badges not-prose" aria-label="Notebook resources"&gt;
&lt;a href="https://github.com/sonthenguyen/alignment" aria-label="View the source repository on GitHub"&gt;
&lt;img
src="https://img.shields.io/badge/GitHub-View_source-181717?logo=github&amp;amp;logoColor=white"
alt="View source on GitHub"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;a href="https://colab.research.google.com/github/sonthenguyen/alignment/blob/main/guided_decoding_for_training_free_alignment.ipynb" aria-label="Open the notebook in Google Colab"&gt;
&lt;img
src="https://colab.research.google.com/assets/colab-badge.svg"
alt="Open in Colab"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;div class="static-notebook-embed not-prose"&gt;
&lt;iframe
id="static-notebook-00edd19bae79927988eb7653a9276bca"
class="static-notebook-frame"
data-src="https://www.sonthenguyen.com/notebooks/guided-decoding-training-free-alignment/"
title="Guided Decoding Tutorial Notebook"
loading="eager"
allowtransparency="true"
sandbox="allow-scripts allow-same-origin"
&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;script&gt;
(() =&gt; {
const frame = document.getElementById("static-notebook-00edd19bae79927988eb7653a9276bca");
if (!frame) return;
const resize = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const height = Math.max(
doc.documentElement.scrollHeight,
doc.body ? doc.body.scrollHeight : 0
);
if (height) frame.style.height = `${height}px`;
};
const syncTheme = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const dark = document.documentElement.classList.contains('dark');
const hostStyle = window.getComputedStyle(document.body);
const hostBackground = hostStyle.backgroundColor;
const hostBackgroundImage = hostStyle.backgroundImage;
const hostForeground = window.getComputedStyle(document.body).color;
const transparentHost = hostBackground === 'rgba(0, 0, 0, 0)' || hostBackground === 'transparent';
const base = transparentHost ? (dark ? '#111d4a' : '#fff8f0') : hostBackground;
const notebookBackground = hostBackgroundImage &amp;&amp; hostBackgroundImage !== 'none'
? `${hostBackgroundImage}, ${base}`
: base;
doc.documentElement.dataset.hbTheme = dark ? 'dark' : 'light';
doc.documentElement.style.setProperty('--notebook-page-bg', notebookBackground);
doc.documentElement.style.setProperty('--notebook-page-fg', hostForeground);
doc.documentElement.style.setProperty(
'--notebook-border',
`color-mix(in srgb, ${hostForeground} 24%, transparent)`
);
doc.documentElement.style.setProperty(
'--notebook-inline-bg',
`color-mix(in srgb, ${hostBackground} 76%, ${hostForeground} 24%)`
);
doc.documentElement.style.setProperty(
'--notebook-code-bg',
`color-mix(in srgb, ${hostBackground} 68%, black 32%)`
);
frame.style.background = notebookBackground;
};
const initialize = () =&gt; {
const doc = frame.contentDocument;
if (doc &amp;&amp; !doc.getElementById('hugo-notebook-theme')) {
const style = doc.createElement('style');
style.id = 'hugo-notebook-theme';
style.textContent = `
html, body {
background: var(--notebook-page-bg) !important;
color: var(--notebook-page-fg) !important;
}
main, #notebook, #notebook-container {
background: transparent !important;
color: var(--notebook-page-fg) !important;
}
#notebook-container {
box-shadow: none !important;
}
html[data-hb-theme="dark"] body,
html[data-hb-theme="dark"] .rendered_html,
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_area pre,
html[data-hb-theme="dark"] .output_subarea {
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html code {
border: 1px solid var(--notebook-border) !important;
background: var(--notebook-inline-bg) !important;
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .rendered_html pre {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .input_area {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
}
html[data-hb-theme="dark"] .prompt {
color: #60a5fa !important;
}
html[data-hb-theme="dark"] .input_area pre,
html[data-hb-theme="dark"] .input_area code,
html[data-hb-theme="dark"] .highlight {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .highlight .c,
html[data-hb-theme="dark"] .highlight .ch,
html[data-hb-theme="dark"] .highlight .cm,
html[data-hb-theme="dark"] .highlight .c1,
html[data-hb-theme="dark"] .highlight .cs {
color: #94a3b8 !important;
font-style: italic;
}
html[data-hb-theme="dark"] .highlight .k,
html[data-hb-theme="dark"] .highlight .kc,
html[data-hb-theme="dark"] .highlight .kd,
html[data-hb-theme="dark"] .highlight .kn,
html[data-hb-theme="dark"] .highlight .kp,
html[data-hb-theme="dark"] .highlight .kr,
html[data-hb-theme="dark"] .highlight .kt,
html[data-hb-theme="dark"] .highlight .ow {
color: #f472b6 !important;
}
html[data-hb-theme="dark"] .highlight .s,
html[data-hb-theme="dark"] .highlight .sa,
html[data-hb-theme="dark"] .highlight .sb,
html[data-hb-theme="dark"] .highlight .sc,
html[data-hb-theme="dark"] .highlight .dl,
html[data-hb-theme="dark"] .highlight .sd,
html[data-hb-theme="dark"] .highlight .s1,
html[data-hb-theme="dark"] .highlight .s2,
html[data-hb-theme="dark"] .highlight .se,
html[data-hb-theme="dark"] .highlight .sh,
html[data-hb-theme="dark"] .highlight .si,
html[data-hb-theme="dark"] .highlight .sx,
html[data-hb-theme="dark"] .highlight .sr,
html[data-hb-theme="dark"] .highlight .ss {
color: #fde68a !important;
}
html[data-hb-theme="dark"] .highlight .m,
html[data-hb-theme="dark"] .highlight .mb,
html[data-hb-theme="dark"] .highlight .mf,
html[data-hb-theme="dark"] .highlight .mh,
html[data-hb-theme="dark"] .highlight .mi,
html[data-hb-theme="dark"] .highlight .mo,
html[data-hb-theme="dark"] .highlight .il {
color: #c4b5fd !important;
}
html[data-hb-theme="dark"] .highlight .nb,
html[data-hb-theme="dark"] .highlight .bp {
color: #67e8f9 !important;
}
html[data-hb-theme="dark"] .highlight .nc,
html[data-hb-theme="dark"] .highlight .nf,
html[data-hb-theme="dark"] .highlight .nn {
color: #86efac !important;
}
html[data-hb-theme="dark"] .highlight .n,
html[data-hb-theme="dark"] .highlight .na,
html[data-hb-theme="dark"] .highlight .nd,
html[data-hb-theme="dark"] .highlight .ne,
html[data-hb-theme="dark"] .highlight .ni,
html[data-hb-theme="dark"] .highlight .nl,
html[data-hb-theme="dark"] .highlight .no,
html[data-hb-theme="dark"] .highlight .nt,
html[data-hb-theme="dark"] .highlight .nv,
html[data-hb-theme="dark"] .highlight .nx,
html[data-hb-theme="dark"] .highlight .py,
html[data-hb-theme="dark"] .highlight .p,
html[data-hb-theme="dark"] .highlight .o {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_subarea,
html[data-hb-theme="dark"] .output_area pre {
background: transparent !important;
}
html[data-hb-theme="dark"] .output_stderr {
background: #3f1d25 !important;
color: #fecdd3 !important;
}
html[data-hb-theme="dark"] .rendered_html table,
html[data-hb-theme="dark"] .rendered_html tr,
html[data-hb-theme="dark"] .rendered_html th,
html[data-hb-theme="dark"] .rendered_html td {
border-color: var(--notebook-border) !important;
background: transparent !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html tr:nth-child(2n) {
background: rgba(255, 255, 255, 0.035) !important;
}
html[data-hb-theme="dark"] .rendered_html a {
color: #93c5fd !important;
}
html[data-hb-theme="dark"] .rendered_html hr {
border-color: var(--notebook-border) !important;
}
`;
doc.head.appendChild(style);
}
syncTheme();
resize();
window.requestAnimationFrame(() =&gt; {
frame.classList.add('is-ready');
});
const body = frame.contentDocument &amp;&amp; frame.contentDocument.body;
if (body &amp;&amp; 'ResizeObserver' in window) {
new ResizeObserver(resize).observe(body);
}
window.setTimeout(resize, 500);
window.setTimeout(resize, 1500);
};
frame.addEventListener('load', initialize);
frame.src = frame.dataset.src;
window.addEventListener('pageshow', () =&gt; {
const doc = frame.contentDocument;
const href = frame.contentWindow &amp;&amp; frame.contentWindow.location.href;
if (doc &amp;&amp; doc.readyState === 'complete' &amp;&amp; href &amp;&amp; href !== 'about:blank') {
initialize();
}
});
window.addEventListener('resize', resize);
new MutationObserver(syncTheme).observe(document.documentElement, {
attributes: true,
attributeFilter: ['class']
});
})();
&lt;/script&gt;</description></item><item><title>Prompt Engineering for Training-Free Alignment of LLMs</title><link>https://www.sonthenguyen.com/mosttheblog/prompt-engineering-for-training-free-alignment-of-llms/</link><pubDate>Tue, 11 Aug 2026 16:00:00 +0000</pubDate><guid>https://www.sonthenguyen.com/mosttheblog/prompt-engineering-for-training-free-alignment-of-llms/</guid><description>&lt;p&gt;This hands-on tutorial introduces programmatic prompt engineering with DSPy,
from hosting a local language model to defining signatures and modules,
evaluating a reasoning pipeline, and optimizing it with MIPROv2.&lt;/p&gt;
&lt;p&gt;This notebook was developed and curated by Tommy Cheng for the NAIRR 2026
Training-Free Alignment of LLMs tutorial.&lt;/p&gt;
&lt;div class="notebook-resource-badges not-prose" aria-label="Notebook resources"&gt;
&lt;a href="https://github.com/sonthenguyen/alignment" aria-label="View the source repository on GitHub"&gt;
&lt;img
src="https://img.shields.io/badge/GitHub-View_source-181717?logo=github&amp;amp;logoColor=white"
alt="View source on GitHub"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;a href="https://colab.research.google.com/github/sonthenguyen/alignment/blob/main/prompt_engineering_for_training_free_alignment.ipynb" aria-label="Open the notebook in Google Colab"&gt;
&lt;img
src="https://colab.research.google.com/assets/colab-badge.svg"
alt="Open in Colab"
loading="lazy"
height="20"
&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;div class="static-notebook-embed not-prose"&gt;
&lt;iframe
id="static-notebook-a4e123cea8a70da5ffdf1c023a26dea7"
class="static-notebook-frame"
data-src="https://www.sonthenguyen.com/notebooks/prompt-engineering-training-free-alignment/"
title="Prompt Engineering Tutorial Notebook"
loading="eager"
allowtransparency="true"
sandbox="allow-scripts allow-same-origin"
&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;script&gt;
(() =&gt; {
const frame = document.getElementById("static-notebook-a4e123cea8a70da5ffdf1c023a26dea7");
if (!frame) return;
const resize = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const height = Math.max(
doc.documentElement.scrollHeight,
doc.body ? doc.body.scrollHeight : 0
);
if (height) frame.style.height = `${height}px`;
};
const syncTheme = () =&gt; {
const doc = frame.contentDocument;
if (!doc) return;
const dark = document.documentElement.classList.contains('dark');
const hostStyle = window.getComputedStyle(document.body);
const hostBackground = hostStyle.backgroundColor;
const hostBackgroundImage = hostStyle.backgroundImage;
const hostForeground = window.getComputedStyle(document.body).color;
const transparentHost = hostBackground === 'rgba(0, 0, 0, 0)' || hostBackground === 'transparent';
const base = transparentHost ? (dark ? '#111d4a' : '#fff8f0') : hostBackground;
const notebookBackground = hostBackgroundImage &amp;&amp; hostBackgroundImage !== 'none'
? `${hostBackgroundImage}, ${base}`
: base;
doc.documentElement.dataset.hbTheme = dark ? 'dark' : 'light';
doc.documentElement.style.setProperty('--notebook-page-bg', notebookBackground);
doc.documentElement.style.setProperty('--notebook-page-fg', hostForeground);
doc.documentElement.style.setProperty(
'--notebook-border',
`color-mix(in srgb, ${hostForeground} 24%, transparent)`
);
doc.documentElement.style.setProperty(
'--notebook-inline-bg',
`color-mix(in srgb, ${hostBackground} 76%, ${hostForeground} 24%)`
);
doc.documentElement.style.setProperty(
'--notebook-code-bg',
`color-mix(in srgb, ${hostBackground} 68%, black 32%)`
);
frame.style.background = notebookBackground;
};
const initialize = () =&gt; {
const doc = frame.contentDocument;
if (doc &amp;&amp; !doc.getElementById('hugo-notebook-theme')) {
const style = doc.createElement('style');
style.id = 'hugo-notebook-theme';
style.textContent = `
html, body {
background: var(--notebook-page-bg) !important;
color: var(--notebook-page-fg) !important;
}
main, #notebook, #notebook-container {
background: transparent !important;
color: var(--notebook-page-fg) !important;
}
#notebook-container {
box-shadow: none !important;
}
html[data-hb-theme="dark"] body,
html[data-hb-theme="dark"] .rendered_html,
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_area pre,
html[data-hb-theme="dark"] .output_subarea {
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html code {
border: 1px solid var(--notebook-border) !important;
background: var(--notebook-inline-bg) !important;
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .rendered_html pre {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .input_area {
border-color: var(--notebook-border) !important;
background: var(--notebook-code-bg) !important;
}
html[data-hb-theme="dark"] .prompt {
color: #60a5fa !important;
}
html[data-hb-theme="dark"] .input_area pre,
html[data-hb-theme="dark"] .input_area code,
html[data-hb-theme="dark"] .highlight {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .highlight .c,
html[data-hb-theme="dark"] .highlight .ch,
html[data-hb-theme="dark"] .highlight .cm,
html[data-hb-theme="dark"] .highlight .c1,
html[data-hb-theme="dark"] .highlight .cs {
color: #94a3b8 !important;
font-style: italic;
}
html[data-hb-theme="dark"] .highlight .k,
html[data-hb-theme="dark"] .highlight .kc,
html[data-hb-theme="dark"] .highlight .kd,
html[data-hb-theme="dark"] .highlight .kn,
html[data-hb-theme="dark"] .highlight .kp,
html[data-hb-theme="dark"] .highlight .kr,
html[data-hb-theme="dark"] .highlight .kt,
html[data-hb-theme="dark"] .highlight .ow {
color: #f472b6 !important;
}
html[data-hb-theme="dark"] .highlight .s,
html[data-hb-theme="dark"] .highlight .sa,
html[data-hb-theme="dark"] .highlight .sb,
html[data-hb-theme="dark"] .highlight .sc,
html[data-hb-theme="dark"] .highlight .dl,
html[data-hb-theme="dark"] .highlight .sd,
html[data-hb-theme="dark"] .highlight .s1,
html[data-hb-theme="dark"] .highlight .s2,
html[data-hb-theme="dark"] .highlight .se,
html[data-hb-theme="dark"] .highlight .sh,
html[data-hb-theme="dark"] .highlight .si,
html[data-hb-theme="dark"] .highlight .sx,
html[data-hb-theme="dark"] .highlight .sr,
html[data-hb-theme="dark"] .highlight .ss {
color: #fde68a !important;
}
html[data-hb-theme="dark"] .highlight .m,
html[data-hb-theme="dark"] .highlight .mb,
html[data-hb-theme="dark"] .highlight .mf,
html[data-hb-theme="dark"] .highlight .mh,
html[data-hb-theme="dark"] .highlight .mi,
html[data-hb-theme="dark"] .highlight .mo,
html[data-hb-theme="dark"] .highlight .il {
color: #c4b5fd !important;
}
html[data-hb-theme="dark"] .highlight .nb,
html[data-hb-theme="dark"] .highlight .bp {
color: #67e8f9 !important;
}
html[data-hb-theme="dark"] .highlight .nc,
html[data-hb-theme="dark"] .highlight .nf,
html[data-hb-theme="dark"] .highlight .nn {
color: #86efac !important;
}
html[data-hb-theme="dark"] .highlight .n,
html[data-hb-theme="dark"] .highlight .na,
html[data-hb-theme="dark"] .highlight .nd,
html[data-hb-theme="dark"] .highlight .ne,
html[data-hb-theme="dark"] .highlight .ni,
html[data-hb-theme="dark"] .highlight .nl,
html[data-hb-theme="dark"] .highlight .no,
html[data-hb-theme="dark"] .highlight .nt,
html[data-hb-theme="dark"] .highlight .nv,
html[data-hb-theme="dark"] .highlight .nx,
html[data-hb-theme="dark"] .highlight .py,
html[data-hb-theme="dark"] .highlight .p,
html[data-hb-theme="dark"] .highlight .o {
color: #f8fafc !important;
}
html[data-hb-theme="dark"] .output_area,
html[data-hb-theme="dark"] .output_subarea,
html[data-hb-theme="dark"] .output_area pre {
background: transparent !important;
}
html[data-hb-theme="dark"] .output_stderr {
background: #3f1d25 !important;
color: #fecdd3 !important;
}
html[data-hb-theme="dark"] .rendered_html table,
html[data-hb-theme="dark"] .rendered_html tr,
html[data-hb-theme="dark"] .rendered_html th,
html[data-hb-theme="dark"] .rendered_html td {
border-color: var(--notebook-border) !important;
background: transparent !important;
color: #e5e7eb !important;
}
html[data-hb-theme="dark"] .rendered_html tr:nth-child(2n) {
background: rgba(255, 255, 255, 0.035) !important;
}
html[data-hb-theme="dark"] .rendered_html a {
color: #93c5fd !important;
}
html[data-hb-theme="dark"] .rendered_html hr {
border-color: var(--notebook-border) !important;
}
`;
doc.head.appendChild(style);
}
syncTheme();
resize();
window.requestAnimationFrame(() =&gt; {
frame.classList.add('is-ready');
});
const body = frame.contentDocument &amp;&amp; frame.contentDocument.body;
if (body &amp;&amp; 'ResizeObserver' in window) {
new ResizeObserver(resize).observe(body);
}
window.setTimeout(resize, 500);
window.setTimeout(resize, 1500);
};
frame.addEventListener('load', initialize);
frame.src = frame.dataset.src;
window.addEventListener('pageshow', () =&gt; {
const doc = frame.contentDocument;
const href = frame.contentWindow &amp;&amp; frame.contentWindow.location.href;
if (doc &amp;&amp; doc.readyState === 'complete' &amp;&amp; href &amp;&amp; href !== 'about:blank') {
initialize();
}
});
window.addEventListener('resize', resize);
new MutationObserver(syncTheme).observe(document.documentElement, {
attributes: true,
attributeFilter: ['class']
});
})();
&lt;/script&gt;</description></item></channel></rss>