<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nocturne</title><link>https://tiennm99.github.io/nocturne/</link><description>Recent content on nocturne</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 20 Aug 2026 19:30:00 +0700</lastBuildDate><atom:link href="https://tiennm99.github.io/nocturne/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo's built-in shortcodes</title><link>https://tiennm99.github.io/nocturne/2026/08/20/shortcodes/</link><pubDate>Thu, 20 Aug 2026 19:30:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/08/20/shortcodes/</guid><description>&lt;p&gt;A shortcode is a small template you call from the middle of Markdown, written as &lt;code&gt;{{&amp;lt; name params &amp;gt;}}&lt;/code&gt;. Hugo ships a set of them, and this post tries each one in turn. Every section shows the source first and the result right after.&lt;/p&gt;
&lt;p&gt;The shortcodes that embed third-party content (YouTube, Vimeo, X, Instagram) are left out: they pull in code from someone else&amp;rsquo;s servers as soon as the page opens, and a demo site should not push that on its visitors.&lt;/p&gt;
&lt;h2 id="why-nocturne-has-no-shortcodes-of-its-own"&gt;Why nocturne has no shortcodes of its own&lt;/h2&gt;&lt;p&gt;A post that uses a theme&amp;rsquo;s own shortcode is tied to that theme: switch themes and the build fails on that post, and you are left fixing files one by one. nocturne wants your content to stay plain Markdown that reads fine on GitHub, in your editor, and wherever you move it next.&lt;/p&gt;
&lt;p&gt;Everything the theme does to your content goes through render hooks instead: captioned images, GitHub-style alerts, scrolling tables, links to &lt;code&gt;.md&lt;/code&gt; files. You write standard Markdown and the theme handles the presentation. If you really need a shortcode, put it in your site&amp;rsquo;s &lt;code&gt;layouts/_shortcodes/&lt;/code&gt; — it belongs to your content, not to the theme.&lt;/p&gt;
&lt;h2 id="figure"&gt;figure&lt;/h2&gt;&lt;p&gt;An image with a caption and a link, written as a shortcode rather than Markdown image syntax:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; figure
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; src=&amp;#34;https://tiennm99.github.io/nocturne/img/tinh-tu-static.png&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; alt=&amp;#34;A test card with six vertical colour bars&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; caption=&amp;#34;A test card, stored in the static folder.&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; link=&amp;#34;https://en.wikipedia.org/wiki/Test_card&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure&gt;&lt;a href="https://en.wikipedia.org/wiki/Test_card"&gt;&lt;img src="https://tiennm99.github.io/nocturne/img/tinh-tu-static.png"
 alt="A broadcast test card: six vertical bars in red, green, yellow, blue, magenta and cyan, crossed by a diagonal rainbow streak"&gt;&lt;/a&gt;&lt;figcaption&gt;
 &lt;p&gt;A test card, stored in the static folder. Click the image to read about test cards.&lt;/p&gt;
 &lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;For an image in the bundle, the Markdown syntax &lt;code&gt;![alt](image.jpg &amp;quot;caption&amp;quot;)&lt;/code&gt; produces the same &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; and adds a &lt;code&gt;srcset&lt;/code&gt; on top; see &lt;a href="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/"&gt;the post about images&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Sites in a subfolder&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;&lt;code&gt;figure&lt;/code&gt; looks for &lt;code&gt;src&lt;/code&gt; in the bundle and then in &lt;code&gt;assets/&lt;/code&gt;, but it does not add the base path to files in &lt;code&gt;static/&lt;/code&gt;. The demo lives under &lt;code&gt;/nocturne/&lt;/code&gt;, so &lt;code&gt;src=&amp;quot;/img/tinh-tu-static.png&amp;quot;&lt;/code&gt; would point outside the site; that is why the example above uses a full URL. Markdown image syntax has no such problem, because the theme&amp;rsquo;s render hook adds the base path for you.&lt;/p&gt;
&lt;/blockquote&gt;&lt;h2 id="details"&gt;details&lt;/h2&gt;&lt;p&gt;A collapsible block whose content is still written in Markdown:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; details summary=&amp;#34;Show the top of hugo.yaml&amp;#34; &amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; /details &amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;details&gt;
 &lt;summary&gt;Show the top of hugo.yaml&lt;/summary&gt;
 &lt;p&gt;The first three lines of &lt;code&gt;hugo.yaml&lt;/code&gt; for an English site using nocturne:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;nocturne&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;languageCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;en&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;defaultContentLanguage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;en&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The full required block is in the &lt;a href="https://github.com/tiennm99/nocturne/blob/main/docs/config.md" rel="noopener noreferrer"&gt;configuration docs&lt;/a&gt;.&lt;/p&gt;
&lt;/details&gt;

&lt;p&gt;Add &lt;code&gt;open=true&lt;/code&gt; to have the block open when the page loads.&lt;/p&gt;
&lt;h2 id="highlight"&gt;highlight&lt;/h2&gt;&lt;p&gt;The same highlighter as fenced code blocks, with the options passed as shortcode parameters:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; highlight go &amp;#34;linenos=inline,hl_lines=3&amp;#34; &amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; /highlight &amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;1&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;2&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line hl"&gt;&lt;span class="ln"&gt;3&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;		&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;friend&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;4&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;5&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Hello, &amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;6&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In a post, a fenced block such as &lt;code&gt;```go {hl_lines=3}&lt;/code&gt; is tidier; &lt;code&gt;highlight&lt;/code&gt; earns its keep when the code sits inside a template or another shortcode.&lt;/p&gt;
&lt;h2 id="qr"&gt;qr&lt;/h2&gt;&lt;p&gt;Generates a QR code at build time, as a PNG served with the site:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{&amp;lt; qr text=&amp;#34;https://tiennm99.github.io/nocturne/&amp;#34; alt=&amp;#34;...&amp;#34; /&amp;gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;img src="https://tiennm99.github.io/nocturne/qr_bab63491ad8219.png" width="148" height="148" alt="QR code linking to the nocturne demo site"&gt;
&lt;p&gt;Scan it with your phone to open this demo.&lt;/p&gt;
&lt;h2 id="param"&gt;param&lt;/h2&gt;&lt;p&gt;Reads a parameter, looking in the page&amp;rsquo;s front matter first and then in the site&amp;rsquo;s &lt;code&gt;params&lt;/code&gt;:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th style="text-align: left"&gt;Source&lt;/th&gt;
 &lt;th style="text-align: left"&gt;Result&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;{{&amp;lt; param &amp;quot;author&amp;quot; &amp;gt;}}&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Your Name&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;{{&amp;lt; param &amp;quot;toc.minWordCount&amp;quot; &amp;gt;}}&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;400&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;{{&amp;lt; param &amp;quot;description&amp;quot; &amp;gt;}}&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;figure, details, highlight, qr, param, ref and relref — the shortcodes Hugo ships with, all working in nocturne without the theme adding any of its own.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;&lt;p&gt;The last row is a small trap: the site has &lt;code&gt;params.description&lt;/code&gt;, but this post has a &lt;code&gt;description&lt;/code&gt; in its front matter too, so &lt;code&gt;param&lt;/code&gt; returns the post&amp;rsquo;s own. The dot in &lt;code&gt;toc.minWordCount&lt;/code&gt; reaches into a nested parameter.&lt;/p&gt;
&lt;h2 id="ref-and-relref"&gt;ref and relref&lt;/h2&gt;&lt;p&gt;These two look up a page by its path under &lt;code&gt;content/&lt;/code&gt; and return its URL. If the page does not exist the build fails, so a broken link can never go live.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ref&lt;/code&gt; returns the full URL: &lt;code&gt;https://tiennm99.github.io/nocturne/2026/07/03/khoi-code/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;relref&lt;/code&gt; returns the path without the host: &lt;code&gt;/nocturne/2026/07/03/khoi-code/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Most of the time they sit inside a Markdown link, optionally with a &lt;code&gt;#&lt;/code&gt; fragment pointing at a heading:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[&lt;span class="nt"&gt;A Markdown tour&lt;/span&gt;](&lt;span class="na"&gt;{{&amp;lt; relref &amp;#34;/post/2026/05/07/sample&amp;#34; &amp;gt;}}&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[&lt;span class="nt"&gt;its Alerts section&lt;/span&gt;](&lt;span class="na"&gt;{{&amp;lt; relref &amp;#34;/post/2026/05/07/sample#alerts&amp;#34; &amp;gt;}}&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result: &lt;a href="https://tiennm99.github.io/nocturne/2026/08/20/shortcodes//nocturne/2026/05/07/sample/"&gt;A Markdown tour&lt;/a&gt; and &lt;a href="https://tiennm99.github.io/nocturne/2026/08/20/shortcodes//nocturne/2026/05/07/sample/#alerts"&gt;its Alerts section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In nocturne, a Markdown link straight to the file, such as &lt;code&gt;[post](/post/2026/05/07/sample/index.md)&lt;/code&gt;, gives the same URL without any shortcode; &lt;code&gt;ref&lt;/code&gt; and &lt;code&gt;relref&lt;/code&gt; still pay off when you want the build to stop the moment the target page disappears.&lt;/p&gt;</description></item><item><title>Code blocks</title><link>https://tiennm99.github.io/nocturne/2026/07/03/khoi-code/</link><pubDate>Fri, 03 Jul 2026 21:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/07/03/khoi-code/</guid><description>&lt;p&gt;Hugo highlights code at build time with Chroma, so the page needs no JavaScript library for it. The site sets &lt;code&gt;markup.highlight.noClasses: false&lt;/code&gt;: Chroma only adds CSS classes, and the colours live in the theme&amp;rsquo;s &lt;code&gt;syntax.css&lt;/code&gt;, switching with light and dark mode. Each block has a language label and a &lt;strong&gt;Copy&lt;/strong&gt; button in its top corner.&lt;/p&gt;
&lt;h2 id="seven-languages"&gt;Seven languages&lt;/h2&gt;&lt;h3 id="go"&gt;Go&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Hello from nocturne at %s\n&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;15:04&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="python"&gt;Python&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;count_posts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;Count posts: each post is a folder holding an index.md.&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rglob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;index.md&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count_posts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;content/post&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="bash"&gt;Bash&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/usr/bin/env bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Create a bundle for a new post, dated today&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;day&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;date +%Y/%m/%d&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hugo new content &lt;span class="s2"&gt;&amp;#34;post/&lt;/span&gt;&lt;span class="nv"&gt;$day&lt;/span&gt;&lt;span class="s2"&gt;/new-post/index.md&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hugo server --buildDrafts
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="yaml"&gt;YAML&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;markup&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;highlight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;noClasses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# colours live in the theme&amp;#39;s syntax.css&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;toc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;enable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;minWordCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;400&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="javascript"&gt;JavaScript&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Collapse a burst of calls into one, for example while the user is typing
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;timer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;timer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="diff"&gt;Diff&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-diff" data-lang="diff"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; params:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; toc:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- minWordCount: 400
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+ minWordCount: 250
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; showWordCount: true
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="json"&gt;JSON&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Code blocks&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;tags&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;code&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;markdown&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;draft&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;readingTime&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="line-numbers"&gt;Line numbers&lt;/h2&gt;&lt;p&gt;Add attributes after the language name on the opening fence. &lt;code&gt;{linenos=table}&lt;/code&gt; puts the line numbers in a column of their own, fully apart from the code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;span class="lnt"&gt;6
&lt;/span&gt;&lt;span class="lnt"&gt;7
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="nb"&gt;rune&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;		&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;	&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;code&gt;{linenos=inline}&lt;/code&gt; writes the numbers at the start of each line of code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;1&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;a sky full of stars tonight&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;2&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ln"&gt;3&lt;/span&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;longest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;linenostart&lt;/code&gt; picks the first number, handy when quoting a few lines from the middle of a long file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;42
&lt;/span&gt;&lt;span class="lnt"&gt;43
&lt;/span&gt;&lt;span class="lnt"&gt;44
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;pagination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;pagerSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;page&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="highlighted-lines"&gt;Highlighted lines&lt;/h2&gt;&lt;p&gt;&lt;code&gt;{hl_lines=[2,&amp;quot;4-5&amp;quot;]}&lt;/code&gt; highlights line 2 and lines 4 to 5, drawing the reader&amp;rsquo;s eye to what matters:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line hl"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;saved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;theme&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line hl"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line hl"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Theme: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;saved&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="no-language"&gt;No language&lt;/h2&gt;&lt;p&gt;A fence without a language shows plain monospace text with no colours and no label, but it still gets a copy button:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nocturne/
├── layouts/
├── assets/
└── exampleSite/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A block indented by four spaces is Markdown&amp;rsquo;s older code syntax, and it is treated just the same:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hugo version
hugo env
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="the-copy-button"&gt;The copy button&lt;/h2&gt;&lt;p&gt;The &lt;strong&gt;Copy&lt;/strong&gt; button copies the code exactly, keeping the lines as they are in the source. Line numbers are left out, whether they sit in their own column (&lt;code&gt;table&lt;/code&gt;) or inside the code (&lt;code&gt;inline&lt;/code&gt;), so whatever you paste runs as is. After a click the button reads &lt;strong&gt;Copied&lt;/strong&gt; for a moment, and screen readers announce the result too.&lt;/p&gt;
&lt;p&gt;The button only appears when the browser allows writing to the clipboard, which means over HTTPS or on &lt;code&gt;localhost&lt;/code&gt;. When you print the page, copy buttons are hidden.&lt;/p&gt;</description></item><item><title>Images in a post</title><link>https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/</link><pubDate>Fri, 12 Jun 2026 20:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/</guid><description>&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/dem-thanh-pho.jpg" alt="A horizontal gradient from near-black navy on the left to pale sky blue on the right, like a city sky at dusk"&gt;&lt;p&gt;That is &lt;code&gt;dem-thanh-pho.jpg&lt;/code&gt; (1600×900), stored in the same folder as the post. As the first image, right at the top, it is likely the largest thing on screen when the page appears, so the theme loads it straight away with &lt;code&gt;loading=&amp;quot;eager&amp;quot;&lt;/code&gt; and &lt;code&gt;fetchpriority=&amp;quot;high&amp;quot;&lt;/code&gt;. Every image after it loads lazily, as the reader scrolls near.&lt;/p&gt;
&lt;p&gt;Hugo knows the image&amp;rsquo;s size, so the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; carries &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt;: the browser reserves the space and the text does not jump when the image arrives. It also gets a &lt;code&gt;srcset&lt;/code&gt; of WebP copies 480, 960, 1440 and 1600 pixels wide, and the browser picks the one that fits the screen. Click the image to open the original file.&lt;/p&gt;
&lt;p&gt;The same image is set as &lt;code&gt;cover.image&lt;/code&gt; in the front matter. The theme does not draw a cover above the post; it uses the image for the Open Graph card shown when someone pastes the post&amp;rsquo;s link into a social network or a chat app.&lt;/p&gt;
&lt;h2 id="images-in-the-bundle"&gt;Images in the bundle&lt;/h2&gt;&lt;p&gt;An image next to &lt;code&gt;index.md&lt;/code&gt; is a page resource, referenced by its file name alone. JPEG, PNG and WebP files get resized copies at build time; SVG and GIF are served as they are.&lt;/p&gt;
&lt;h3 id="a-png-with-attributes"&gt;A PNG with attributes&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/hoa-van.png" alt="A 16:9 frame whose background shades from navy through blue to teal, with a charcoal square in the middle" class="wide" id="hoa-van"&gt;&lt;p&gt;&lt;code&gt;hoa-van.png&lt;/code&gt; (1200×675) gets the same treatment as the JPG: a size and a WebP &lt;code&gt;srcset&lt;/code&gt;. The &lt;code&gt;{#hoa-van .wide}&lt;/code&gt; line right below it is a Markdown attribute that puts an &lt;code&gt;id&lt;/code&gt; and a class on the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; itself. That lets you &lt;a href="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/#hoa-van"&gt;link to this exact image&lt;/a&gt; or style the &lt;code&gt;wide&lt;/code&gt; class in your own CSS.&lt;/p&gt;
&lt;h3 id="a-webp-with-a-caption"&gt;A WebP with a caption&lt;/h3&gt;&lt;figure&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/binh-minh.webp" alt="A diagonal gradient from dark moss green in the bottom-left corner to pale teal in the top right"&gt;&lt;figcaption&gt;Sunrise: this image has a title in quotes, so it is wrapped in a figure and the title becomes this caption.&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;An image that stands alone in its paragraph and has a title becomes a &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; with a &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt;. The alt text describes what is in the picture for screen reader users, while the caption is a remark everyone sees; the two should complement each other, not repeat each other.&lt;/p&gt;
&lt;h3 id="a-gif-served-as-is"&gt;A GIF served as is&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/song.gif" alt="Vertical blue bands, from pale sky blue to near-black, sliding sideways in a loop"&gt;&lt;p&gt;Hugo cannot resize a GIF and keep it moving, so &lt;code&gt;song.gif&lt;/code&gt; is served exactly as stored, with no &lt;code&gt;srcset&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; or &lt;code&gt;height&lt;/code&gt;. It still loads lazily like every other image.&lt;/p&gt;
&lt;h2 id="an-image-inside-a-link"&gt;An image inside a link&lt;/h2&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Compass" rel="noopener noreferrer"&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/la-ban.svg" alt="A round compass face on a dark background with a blue rim and a blue-and-white diamond needle pointing straight up"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;la-ban.svg&lt;/code&gt; is a vector image, so it stays as is: it is sharp at any size and needs no resized copies. It already sits inside a link to Wikipedia, so the theme does not wrap it in a second link to the original file — an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; inside an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; is invalid HTML.&lt;/p&gt;
&lt;h2 id="an-image-from-the-static-folder"&gt;An image from the static folder&lt;/h2&gt;&lt;img src="https://tiennm99.github.io/nocturne/img/tinh-tu-static.png" alt="A broadcast test card: six vertical bars in red, green, yellow, blue, magenta and cyan, crossed by a diagonal rainbow streak"&gt;&lt;p&gt;This file lives at &lt;code&gt;static/img/tinh-tu-static.png&lt;/code&gt; and is referenced with the root-relative path &lt;code&gt;/img/tinh-tu-static.png&lt;/code&gt;. The demo runs under &lt;code&gt;/nocturne/&lt;/code&gt; on GitHub Pages, so the theme adds the base path and the image loads from &lt;code&gt;/nocturne/img/tinh-tu-static.png&lt;/code&gt;. Change &lt;code&gt;baseURL&lt;/code&gt; and the image still shows up, no edits to the post. Files in &lt;code&gt;static/&lt;/code&gt; are not page resources, so there are no resized copies.&lt;/p&gt;
&lt;h2 id="images-from-another-host"&gt;Images from another host&lt;/h2&gt;&lt;img src="https://tiennm99.github.io/nocturne/img/tinh-tu-static.png" alt="The same six-bar test card, this time loaded from a full URL"&gt;&lt;p&gt;A full URL starting with &lt;code&gt;https://&lt;/code&gt; is left untouched. The theme does not download remote images at build time, so it does not know their size.&lt;/p&gt;
&lt;h3 id="a-gif-that-becomes-a-video"&gt;A GIF that becomes a video&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/media/the-gioi-song.gif" alt="Diagonal blue bands, from pale sky blue to almost black, sweeping across the frame in a loop"&gt;&lt;p&gt;To handle remote images, a site can add a &lt;code&gt;layouts/_partials/image/remote.html&lt;/code&gt; partial; the theme calls it for every full URL. The demo&amp;rsquo;s partial knows one case only: a GIF in the &lt;code&gt;/media/&lt;/code&gt; folder that has an MP4 file of the same name. That image is swapped for a muted, looping &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; that loads only when you scroll near it and plays only while it is on screen. The MP4 here weighs about 4 KB against the GIF&amp;rsquo;s 23 KB. With JavaScript turned off, the browser shows the original GIF.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/tiennm99/nocturne/blob/main/docs/customization.md#remote-images" rel="noopener noreferrer"&gt;theme&amp;rsquo;s customization guide&lt;/a&gt; explains how to write this partial.&lt;/p&gt;</description></item><item><title>A Markdown tour</title><link>https://tiennm99.github.io/nocturne/2026/05/07/sample/</link><pubDate>Thu, 07 May 2026 19:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/05/07/sample/</guid><description>&lt;p&gt;This post is a short walk through Markdown: each section uses one piece of syntax and shows how nocturne renders it. To compare with the source, follow the edit link at the end of the page — it opens this very &lt;code&gt;index.en.md&lt;/code&gt; on GitHub.&lt;/p&gt;
&lt;p&gt;The post is long enough to get a table of contents. On a wide screen it sits beside the text and highlights the section you are reading; on a phone it tucks in above the content.&lt;/p&gt;
&lt;h2 id="text-and-links"&gt;Text and links&lt;/h2&gt;&lt;p&gt;A plain sentence can hold &lt;strong&gt;bold&lt;/strong&gt;, &lt;em&gt;italics&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;both at once&lt;/strong&gt;&lt;/em&gt;, &lt;del&gt;a dropped idea&lt;/del&gt; and &lt;code&gt;inline code&lt;/code&gt; such as &lt;code&gt;hugo server --buildDrafts&lt;/code&gt;. Keyboard shortcuts use an HTML tag: &lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;C&lt;/kbd&gt;.&lt;/p&gt;
&lt;p class="lead"&gt;This paragraph carries a &lt;code&gt;lead&lt;/code&gt; class, added by a Markdown attribute on the line right below it. The theme does not style that class, but it is in the HTML for your own CSS to pick up.&lt;/p&gt;
&lt;p&gt;External links such as &lt;a href="https://gohugo.io/documentation/" rel="noopener noreferrer"&gt;Hugo&amp;rsquo;s documentation&lt;/a&gt; get &lt;code&gt;rel=&amp;quot;noopener noreferrer&amp;quot;&lt;/code&gt; added. Internal links can point straight at a Markdown file: &lt;a href="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/"&gt;the post about images&lt;/a&gt; turns into that post&amp;rsquo;s real URL, and &lt;a href="https://tiennm99.github.io/nocturne/2026/07/03/khoi-code/#line-numbers"&gt;the line numbers section of the code post&lt;/a&gt; keeps its &lt;code&gt;#line-numbers&lt;/code&gt; fragment. Change your URL scheme later and these links still work.&lt;/p&gt;
&lt;h3 id="a-heading-with-its-own-class" class="special"&gt;A heading with its own class&lt;/h3&gt;&lt;p&gt;The heading above has a &lt;code&gt;{.special}&lt;/code&gt; attribute. The class is kept and the &lt;code&gt;id&lt;/code&gt; is still generated, so the table of contents and the &lt;code&gt;#&lt;/code&gt; that shows on hover keep working.&lt;/p&gt;
&lt;h2 id="lists-and-to-dos"&gt;Lists and to-dos&lt;/h2&gt;&lt;p&gt;An unordered list, nested:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Content
&lt;ul&gt;
&lt;li&gt;Posts&lt;/li&gt;
&lt;li&gt;About page&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Look and feel
&lt;ul&gt;
&lt;li&gt;Light and dark modes&lt;/li&gt;
&lt;li&gt;A typeface that handles Vietnamese well&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An ordered list, numbered per level:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a folder for the post.&lt;/li&gt;
&lt;li&gt;Write &lt;code&gt;index.md&lt;/code&gt;, then add the &lt;code&gt;index.en.md&lt;/code&gt; translation next to it.
&lt;ol&gt;
&lt;li&gt;Keep the date, category and tags the same.&lt;/li&gt;
&lt;li&gt;Translate the title, description and body.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;hugo server&lt;/code&gt; and read it through once.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A task list:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; Write a draft&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; Add images to the bundle&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Ask a friend to proofread&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Publish&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="definition-lists"&gt;Definition lists&lt;/h3&gt;&lt;dl&gt;
&lt;dt&gt;Bundle&lt;/dt&gt;
&lt;dd&gt;A folder holding &lt;code&gt;index.md&lt;/code&gt; together with the post&amp;rsquo;s images and other files.&lt;/dd&gt;
&lt;dt&gt;Front matter&lt;/dt&gt;
&lt;dd&gt;The YAML block at the top of the file, where the title, date, tags and categories live.&lt;/dd&gt;
&lt;dt&gt;Render hook&lt;/dt&gt;
&lt;dd&gt;A small template that decides how Hugo outputs images, links, headings, tables and blockquotes.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id="tables"&gt;Tables&lt;/h2&gt;&lt;p&gt;Colons in the separator row set each column&amp;rsquo;s alignment:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th style="text-align: left"&gt;Syntax (left)&lt;/th&gt;
 &lt;th style="text-align: center"&gt;Result (centre)&lt;/th&gt;
 &lt;th style="text-align: right"&gt;Characters (right)&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;**bold**&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: center"&gt;&lt;strong&gt;bold&lt;/strong&gt;&lt;/td&gt;
 &lt;td style="text-align: right"&gt;8&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;*italic*&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: center"&gt;&lt;em&gt;italic&lt;/em&gt;&lt;/td&gt;
 &lt;td style="text-align: right"&gt;8&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;~~struck~~&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: center"&gt;&lt;del&gt;struck&lt;/del&gt;&lt;/td&gt;
 &lt;td style="text-align: right"&gt;10&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;`code`&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: center"&gt;&lt;code&gt;code&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: right"&gt;6&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;&lt;h3 id="a-wide-table"&gt;A wide table&lt;/h3&gt;&lt;p&gt;A table with many columns sits in a horizontally scrolling region, so it never stretches the page on a phone. The region takes focus, so keyboard users can scroll it with the arrow keys.&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th style="text-align: left"&gt;Format&lt;/th&gt;
 &lt;th style="text-align: left"&gt;Extension&lt;/th&gt;
 &lt;th style="text-align: left"&gt;Theme handling&lt;/th&gt;
 &lt;th style="text-align: center"&gt;WebP &lt;code&gt;srcset&lt;/code&gt;&lt;/th&gt;
 &lt;th style="text-align: center"&gt;&lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt;&lt;/th&gt;
 &lt;th style="text-align: center"&gt;Animation&lt;/th&gt;
 &lt;th style="text-align: center"&gt;Transparency&lt;/th&gt;
 &lt;th style="text-align: left"&gt;Good for&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;JPEG&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.jpg&lt;/code&gt;, &lt;code&gt;.jpeg&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Resized&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Photos and detailed pictures&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;PNG&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.png&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Resized&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Screenshots and flat artwork&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;WebP&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.webp&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Resized&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Possible&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Most things on today&amp;rsquo;s web&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;SVG&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.svg&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Served as is&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Possible&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Icons, diagrams, logos&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;GIF&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.gif&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Served as is&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;No&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: center"&gt;Yes&lt;/td&gt;
 &lt;td style="text-align: left"&gt;Short loops with few colours&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;&lt;h4 id="when-to-reach-for-a-table"&gt;When to reach for a table&lt;/h4&gt;&lt;p&gt;Tables suit data you compare across rows and columns. For steps done one after another, an ordered list reads better on a narrow screen.&lt;/p&gt;
&lt;h2 id="quotes"&gt;Quotes&lt;/h2&gt;&lt;p&gt;A plain blockquote, no alert styling:&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;A day&amp;rsquo;s travel brings a basketful of wisdom.&lt;/p&gt;
&lt;p&gt;— Vietnamese proverb&lt;/p&gt;

&lt;/blockquote&gt;&lt;h2 id="alerts"&gt;Alerts&lt;/h2&gt;&lt;p&gt;All five GitHub alert types are here. Their default titles follow the page language.&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;Background a reader should know, even when skimming.&lt;/p&gt;
&lt;/blockquote&gt;&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;Run &lt;code&gt;hugo server --navigateToChanged&lt;/code&gt; and the browser jumps to the page you just edited.&lt;/p&gt;
&lt;/blockquote&gt;&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;A translation lives next to the original in the same bundle, named &lt;code&gt;index.en.md&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;Hugo does not merge &lt;code&gt;markup&lt;/code&gt; from a theme, so copy the required config block into your site&amp;rsquo;s &lt;code&gt;hugo.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Caution&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;&lt;code&gt;draft: true&lt;/code&gt; keeps a post out of the build, but the file is still in your repository. If the repository is public, anyone can read it.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;Right after &lt;code&gt;[!TIP]&lt;/code&gt; you can write your own title in place of the default one:&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Keep it short&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;An alert works best with a sentence or two. Any longer and it probably wants a section of its own.&lt;/p&gt;
&lt;/blockquote&gt;&lt;h2 id="footnotes"&gt;Footnotes&lt;/h2&gt;&lt;p&gt;Hugo turns Markdown into HTML with Goldmark&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;. A footnote can have a name instead of a number&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;, and its text always gathers at the end of the post, with an arrow back to where you were reading.&lt;/p&gt;
&lt;h2 id="collapsible-content"&gt;Collapsible content&lt;/h2&gt;&lt;p&gt;The site turns on &lt;code&gt;markup.goldmark.renderer.unsafe&lt;/code&gt;, so hand-written HTML goes straight to the page. A &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; tag makes a block that opens and closes without any JavaScript:&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;Why does every post have two files?&lt;/summary&gt;
&lt;p&gt;Each post is a bundle. &lt;code&gt;index.md&lt;/code&gt; is the Vietnamese version, the site&amp;rsquo;s default language; &lt;code&gt;index.en.md&lt;/code&gt; is the English one. Hugo pairs the two files as translations, and the language picker jumps straight to the matching post.&lt;/p&gt;
&lt;/details&gt;
&lt;p&gt;Hugo also has a &lt;code&gt;details&lt;/code&gt; shortcode that does the same job; see &lt;a href="https://tiennm99.github.io/nocturne/2026/08/20/shortcodes/"&gt;the shortcode post&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;The rule above is three dashes, &lt;code&gt;---&lt;/code&gt;, on a line of their own between blank lines. This post was edited after it went out, so an updated date shows under the title.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Goldmark is a Markdown parser written in Go that follows the CommonMark spec.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;The name only exists in the source; on the page, footnotes are still numbered in the order they appear.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Reading and noticing</title><link>https://tiennm99.github.io/nocturne/2026/03/22/doc-sach-quan-sat/</link><pubDate>Sun, 22 Mar 2026 15:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/03/22/doc-sach-quan-sat/</guid><description>&lt;p&gt;For a few months now I have been rereading old books. The first time round I skimmed, mostly to find out how they ended. This time I read slowly, with a pencil nearby, and let myself stop on any page.&lt;/p&gt;
&lt;p&gt;The first discovery surprised me: most of my first impressions of a book were wrong. Not because the book had changed, but because I was reading it differently. A character I once found tiresome now seems sad and likeable. A chapter I thought was padding turns out to be the one the whole story turns on.&lt;/p&gt;
&lt;h2 id="reading-slowly"&gt;Reading slowly&lt;/h2&gt;&lt;p&gt;Reading slowly does not mean reading word by word. It means not turning the page before you understand this one. When a sentence makes me pause, I read it again, then the whole paragraph. More often than not, the place where I paused is the part most worth remembering.&lt;/p&gt;
&lt;p&gt;I also dropped the habit of page targets. An evening of ten pages I still remember beats fifty pages that are gone by morning. A book is not a race, and nobody is keeping score.&lt;/p&gt;
&lt;h2 id="writing-short"&gt;Writing short&lt;/h2&gt;&lt;p&gt;After each session I write exactly three lines: one new thing, one sentence I want to keep, one question. No more. The three-line limit forces me to choose, and choosing is when I actually think about what I just read.&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;Long notes are so you don&amp;rsquo;t have to remember. Short notes are so you do.&lt;/p&gt;

&lt;/blockquote&gt;&lt;p&gt;That line is mine, written one night when I had finished reading and had no energy left for anything longer. Reading it back, I think it holds.&lt;/p&gt;
&lt;h2 id="noticing"&gt;Noticing&lt;/h2&gt;&lt;p&gt;The habit of reading slowly crept into other things without my noticing. On walks, I see that the tree at the end of the lane has new leaves. In conversation, I hear the other person out before thinking about my reply. Small things, but they make a day feel longer in a good way.&lt;/p&gt;
&lt;p&gt;Noticing is a skill you practise, just like reading. At first you see very little; the longer you look, the more there is. And as with reading, the point is not to see everything but to see a few things clearly.&lt;/p&gt;
&lt;h2 id="the-next-book"&gt;The next book&lt;/h2&gt;&lt;p&gt;The reread list is still long, but there is no hurry. Next up is a short story collection that has sat on the shelf for almost ten years. Last time I gave up halfway. This time I will read one story a week and see whether it feels different.&lt;/p&gt;</description></item><item><title>Writing your own Hugo theme</title><link>https://tiennm99.github.io/nocturne/2026/02/14/tu-viet-theme/</link><pubDate>Sat, 14 Feb 2026 21:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/02/14/tu-viet-theme/</guid><description>&lt;p&gt;A month after &lt;a href="https://tiennm99.github.io/nocturne/2026/01/10/ke-hoach-dau-nam/"&gt;the new-year plan&lt;/a&gt;, &lt;code&gt;nocturne&lt;/code&gt; is good enough to write about on itself. This post records the decisions that shaped the theme, so that when I want to add something later, I remember why I left it out in the first place.&lt;/p&gt;
&lt;h2 id="why-build-your-own"&gt;Why build your own&lt;/h2&gt;&lt;p&gt;Using a ready-made theme is like renting a furnished flat: you can move in today, but moving a shelf means asking the landlord. Every time Hugo changed something, I had to read someone else&amp;rsquo;s code to find out whether the theme still worked.&lt;/p&gt;
&lt;p&gt;Writing your own is slower at first, but afterwards everything has an owner. When a page renders wrong, I know which file to open. When a new Hugo release lands, the list of things that might break is short enough to read in one evening.&lt;/p&gt;
&lt;p&gt;There is one more reason: writing a theme makes you actually learn Hugo. Lookup order, page bundles, render hooks, how multilingual sites fit together; you have to touch each of them at least once.&lt;/p&gt;
&lt;h2 id="keep-it-small"&gt;Keep it small&lt;/h2&gt;&lt;p&gt;The rule of thumb: everything added must answer &amp;ldquo;what does the reader get?&amp;rdquo;. If the answer is &amp;ldquo;it looks a bit fancier&amp;rdquo;, the answer is usually no.&lt;/p&gt;
&lt;h3 id="no-build-step"&gt;No build step&lt;/h3&gt;&lt;p&gt;No Node, no bundler, no PostCSS. The CSS is a handful of plain files that Hugo joins, minifies and fingerprints. The JavaScript is small ES modules, one job each: the theme toggle, the copy button on code blocks, the table of contents that tracks your scroll. All of it together is under ten kilobytes before compression.&lt;/p&gt;
&lt;h3 id="data-not-params"&gt;Data, not params&lt;/h3&gt;&lt;p&gt;The home page is a portfolio, but the personal details are not in &lt;code&gt;hugo.yaml&lt;/code&gt;. The bio and links live in &lt;code&gt;data/profile.yaml&lt;/code&gt;, the featured projects in &lt;code&gt;data/projects.yaml&lt;/code&gt;. The config file is left with the switches that turn features on and off, and it reads at a glance.&lt;/p&gt;
&lt;h3 id="no-shortcodes-of-its-own"&gt;No shortcodes of its own&lt;/h3&gt;&lt;p&gt;The theme ships no shortcodes. A shortcode is Hugo-only syntax; once it is in a post, the post is tied to the theme. Whatever Markdown can express, such as captioned images or callout boxes, the theme handles with render hooks, so the content stays plain Markdown.&lt;/p&gt;
&lt;h2 id="dark-by-default"&gt;Dark by default&lt;/h2&gt;&lt;p&gt;I mostly write and read at night, so the dark look is the default, not an afterthought. The moon and sun button in the top corner switches to light, and the choice is remembered for next time.&lt;/p&gt;
&lt;h3 id="no-white-flash"&gt;No white flash&lt;/h3&gt;&lt;p&gt;The hard part of a dark theme is the moment before the CSS applies: the page flashes white, then goes dark. The cure is a tiny script that runs right in &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;, before the browser paints anything:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;theme&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;light&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;data-theme&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;light&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Because dark is the default, the script only has work to do when the reader has picked light. With JavaScript off, the page is still dark and still readable.&lt;/p&gt;
&lt;h3 id="colours-are-tokens"&gt;Colours are tokens&lt;/h3&gt;&lt;p&gt;Every colour is a CSS variable in a single file: dark values on &lt;code&gt;:root&lt;/code&gt;, light values on &lt;code&gt;:root[data-theme=&amp;quot;light&amp;quot;]&lt;/code&gt;. To change the accent colour in both modes, a site overrides a few variables and never touches the theme.&lt;/p&gt;
&lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;When picking colours for a dark background, avoid pure white for text. A warm, moderately bright grey is far easier on the eyes over a long read.&lt;/p&gt;
&lt;/blockquote&gt;&lt;h2 id="vietnamese-typography"&gt;Vietnamese typography&lt;/h2&gt;&lt;p&gt;The theme puts Vietnamese first, so the text got the most care.&lt;/p&gt;
&lt;h3 id="fonts-with-every-diacritic"&gt;Fonts with every diacritic&lt;/h3&gt;&lt;p&gt;The font stack starts with Inter and Be Vietnam Pro, then falls back to system fonts. Both cover the full Vietnamese alphabet; when neither is installed, modern system fonts render it well too. What you want to avoid is a font missing a few glyphs like &amp;ldquo;ữ&amp;rdquo; or &amp;ldquo;ặ&amp;rdquo;, leaving a single word set in two typefaces.&lt;/p&gt;
&lt;h3 id="line-height"&gt;Line height&lt;/h3&gt;&lt;p&gt;Vietnamese stacks diacritics above and below the letters. A body line height of 1.7 keeps one line&amp;rsquo;s marks from touching the next. Headings use tighter spacing, since the type is larger and the lines are few.&lt;/p&gt;
&lt;h3 id="anchors-and-dates"&gt;Anchors and dates&lt;/h3&gt;&lt;p&gt;Heading IDs come out as ASCII, so on the Vietnamese page the section &amp;ldquo;Chữ tiếng Việt&amp;rdquo; is &lt;code&gt;#chu-tieng-viet&lt;/code&gt;: short and easy to share. The letter &amp;ldquo;đ&amp;rdquo; is dropped rather than turned into &amp;ldquo;d&amp;rdquo;, so the Vietnamese headings that contain it get a hand-written ID, as in &lt;code&gt;## Nền tối là mặc định {#nen-toi-la-mac-dinh}&lt;/code&gt;. Dates follow each language&amp;rsquo;s format, so a Vietnamese post shows the date the Vietnamese way rather than &amp;ldquo;February 14, 2026&amp;rdquo;.&lt;/p&gt;
&lt;h2 id="whats-left"&gt;What&amp;rsquo;s left&lt;/h2&gt;&lt;p&gt;There is plenty still to do: the archive page, search, a second language. But the core is solid and, more importantly, I understand every line of it. The rest can wait for later posts.&lt;/p&gt;</description></item><item><title>Planning the new year</title><link>https://tiennm99.github.io/nocturne/2026/01/10/ke-hoach-dau-nam/</link><pubDate>Sat, 10 Jan 2026 08:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/01/10/ke-hoach-dau-nam/</guid><description>&lt;p&gt;At the start of each year I write down three things I want done by the end of June. Never more, because a long list never gets finished. This year one of the three is the Hugo theme I mentioned in &lt;a href="https://tiennm99.github.io/nocturne/2025/08/15/ghi-chu-hugo/"&gt;my notes from August&lt;/a&gt;: &lt;code&gt;nocturne&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="why-write-my-own"&gt;Why write my own&lt;/h2&gt;&lt;p&gt;The theme I use works, but it is heavy. It has a slider, animations, and a whole folder of JavaScript I have never opened. Writing my own is the only way to know why each line is there.&lt;/p&gt;
&lt;h2 id="goals"&gt;Goals&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;No build step for CSS or JS: just Hugo and the ES modules browsers already understand.&lt;/li&gt;
&lt;li&gt;Vietnamese first. Other languages are a bonus, not a requirement.&lt;/li&gt;
&lt;li&gt;The home page is a portfolio; the posts are everything else.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="how-ill-know"&gt;How I&amp;rsquo;ll know&lt;/h2&gt;&lt;p&gt;A goal you cannot check is only a wish, so each one gets a simple test:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; The site runs with &lt;code&gt;hugo server&lt;/code&gt; and no &lt;code&gt;npm install&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; A long post reads comfortably on a phone, even with JavaScript off.&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; One post in Vietnamese plus an English version, and switching between them never loses your place.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="not-doing"&gt;Not doing&lt;/h2&gt;&lt;p&gt;This list matters as much as the one above: no self-hosted comments, no icon library, no CSS framework. When something is needed, write exactly that part.&lt;/p&gt;
&lt;p&gt;More once the theme has taken shape.&lt;/p&gt;</description></item><item><title>Year-end thoughts</title><link>https://tiennm99.github.io/nocturne/2025/12/01/cuoi-nam/</link><pubDate>Mon, 01 Dec 2025 20:30:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2025/12/01/cuoi-nam/</guid><description>&lt;p&gt;The end of the year is a good time to pause. Not to sum things up, just to notice.&lt;/p&gt;
&lt;p&gt;Some things I did better this year than last: going to bed earlier, writing more regularly, not reaching for my phone the moment I wake up. Other things stayed exactly the same. Both are fine. A year does not have to be a growth report.&lt;/p&gt;
&lt;p&gt;What stands out most is that the changes that stuck were all small. Ten minutes of reading before bed, one line in a notebook each evening, a walk after lunch. The big plans, for the most part, are still sitting in the notebook.&lt;/p&gt;
&lt;p&gt;So next year&amp;rsquo;s plan will be small too. Three things, no more.&lt;/p&gt;</description></item><item><title>Notes on Hugo and static sites</title><link>https://tiennm99.github.io/nocturne/2025/08/15/ghi-chu-hugo/</link><pubDate>Fri, 15 Aug 2025 09:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2025/08/15/ghi-chu-hugo/</guid><description>&lt;p&gt;Hugo is a static site generator written in Go. Coming back to it after a long break, I found a fair amount had changed. These are personal notes, not a tutorial: the things I want to remember before starting on something bigger.&lt;/p&gt;
&lt;h2 id="the-new-layout-convention"&gt;The new layout convention&lt;/h2&gt;&lt;p&gt;Since 0.146, the special folders inside &lt;code&gt;layouts/&lt;/code&gt; start with an underscore: &lt;code&gt;_partials&lt;/code&gt;, &lt;code&gt;_markup&lt;/code&gt;, &lt;code&gt;_shortcodes&lt;/code&gt;. The underscore keeps them apart from section names, so a section called &lt;code&gt;partials&lt;/code&gt; can no longer be mistaken for the folder of partials.&lt;/p&gt;
&lt;h3 id="the-_partials-folder"&gt;The &lt;code&gt;_partials&lt;/code&gt; folder&lt;/h3&gt;&lt;p&gt;Reusable template pieces live here: the header, the footer, a post card. A section is a kind of content; a partial is just a piece of the page.&lt;/p&gt;
&lt;h3 id="the-_markup-folder"&gt;The &lt;code&gt;_markup&lt;/code&gt; folder&lt;/h3&gt;&lt;p&gt;Render hooks for Markdown: headings, links, images, code blocks, tables, blockquotes. Hugo finds them on its own while rendering content; nothing needs registering.&lt;/p&gt;
&lt;h3 id="the-_shortcodes-folder"&gt;The &lt;code&gt;_shortcodes&lt;/code&gt; folder&lt;/h3&gt;&lt;p&gt;Exactly what it says. A shortcode placed here in your site overrides the theme&amp;rsquo;s shortcode of the same name.&lt;/p&gt;
&lt;h2 id="the-asset-pipeline"&gt;The asset pipeline&lt;/h2&gt;&lt;p&gt;Hugo needs no external build tool. &lt;code&gt;resources.Get&lt;/code&gt; picks up a file from &lt;code&gt;assets/&lt;/code&gt;, &lt;code&gt;resources.Concat&lt;/code&gt; joins files, &lt;code&gt;minify&lt;/code&gt; compresses them and &lt;code&gt;fingerprint&lt;/code&gt; puts a hash in the file name. For a small to medium site, that is the whole pipeline.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;markup&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;goldmark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;autoHeadingIDType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;github-ascii&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This one setting solves a big problem for anyone writing in Vietnamese: heading IDs come out as plain ASCII, stable and URL-safe. &amp;ldquo;Thư mục&amp;rdquo; becomes &lt;code&gt;#thu-muc&lt;/code&gt; instead of a long run of percent-encoded bytes. Only &amp;ldquo;đ&amp;rdquo; is dropped rather than turned into &amp;ldquo;d&amp;rdquo;; when it matters, write the ID by hand right after the heading text, as the Vietnamese version of this post does with &lt;code&gt;{#di-tiep}&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="render-hooks"&gt;Render hooks&lt;/h2&gt;&lt;p&gt;Render hooks let you step into Markdown rendering without writing a Goldmark extension. A small template in &lt;code&gt;_markup/&lt;/code&gt; is enough.&lt;/p&gt;
&lt;p&gt;A few things I reach for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a &lt;code&gt;#&lt;/code&gt; anchor link next to each heading;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rel=&amp;quot;noopener&amp;quot;&lt;/code&gt; on outbound links;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;srcset&lt;/code&gt;, dimensions and &lt;code&gt;loading=&amp;quot;lazy&amp;quot;&lt;/code&gt; on images, so the page does not jump while it loads.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="things-worth-keeping"&gt;Things worth keeping&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Plain Markdown is a long-term asset. Any generator can read it.&lt;/li&gt;
&lt;li&gt;Hugo is rarely what makes a build slow. When it is slow, the culprit is usually image processing or an over-eager resource pipeline.&lt;/li&gt;
&lt;li&gt;A light theme makes a light site. Every byte of CSS and JS travels over the network to the reader.&lt;/li&gt;
&lt;li&gt;Writing your own theme is how you get to understand every line. Ready-made themes are convenient, but they bring a lot you never needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="whats-next"&gt;What&amp;rsquo;s next&lt;/h2&gt;&lt;p&gt;The project for the coming months: a Hugo theme of my own, small, with no build step and Vietnamese first. It is called &lt;code&gt;nocturne&lt;/code&gt;. I will write it and keep notes along the way in this series.&lt;/p&gt;
&lt;p&gt;The next entry will probably be the actual plan, then the CSS and how to do dark mode without a white flash on first load.&lt;/p&gt;</description></item><item><title>About</title><link>https://tiennm99.github.io/nocturne/about/</link><guid>https://tiennm99.github.io/nocturne/about/</guid><description>&lt;p&gt;This is the demo site for &lt;a href="https://github.com/tiennm99/nocturne" rel="noopener noreferrer"&gt;nocturne&lt;/a&gt;, a Hugo theme for a blog with a personal portfolio: Vietnamese first, dark by default, no build step. Every theme feature is switched on here, and each post shows off a few of them. &amp;ldquo;Your Name&amp;rdquo; is a stand-in; put your own name there when you use the theme.&lt;/p&gt;
&lt;h2 id="what-the-home-page-is-made-of"&gt;What the home page is made of&lt;/h2&gt;&lt;p&gt;The &lt;a href="https://tiennm99.github.io/nocturne/"&gt;home page&lt;/a&gt; is a portfolio built from three parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The intro&lt;/strong&gt;: name, tagline, avatar, bio and links, read from &lt;code&gt;data/profile.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Featured projects&lt;/strong&gt;: a grid of project cards from &lt;code&gt;data/projects.yaml&lt;/code&gt;. A card shows an image, a demo link or tags only when the project has them.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recent posts&lt;/strong&gt;: the five newest entries in &lt;a href="https://tiennm99.github.io/nocturne/post/"&gt;Posts&lt;/a&gt;, with a link to the full list.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="where-the-features-are"&gt;Where the features are&lt;/h2&gt;&lt;p&gt;Posts fall into three categories, each showing a group of features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://tiennm99.github.io/nocturne/categories/demo/"&gt;Demo&lt;/a&gt; holds the technical tours: &lt;a href="https://tiennm99.github.io/nocturne/2026/05/07/sample/"&gt;a Markdown tour&lt;/a&gt; with tables, footnotes and callouts; &lt;a href="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/"&gt;images&lt;/a&gt; with &lt;code&gt;srcset&lt;/code&gt;, captions and a GIF served as video; &lt;a href="https://tiennm99.github.io/nocturne/2026/07/03/khoi-code/"&gt;code blocks&lt;/a&gt; with line highlighting and a copy button; and Hugo&amp;rsquo;s &lt;a href="https://tiennm99.github.io/nocturne/2026/08/20/shortcodes/"&gt;built-in shortcodes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tiennm99.github.io/nocturne/categories/nhat-ky-hugo/"&gt;Hugo diary&lt;/a&gt; is a series: a category chip above the title, previous and next links that stay within the series, and related posts at the end.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tiennm99.github.io/nocturne/categories/ghi-chu/"&gt;Notes&lt;/a&gt; shows per-post overrides: &lt;a href="https://tiennm99.github.io/nocturne/2025/12/01/cuoi-nam/"&gt;one post&lt;/a&gt; turns comments off and uses its own license line, &lt;a href="https://tiennm99.github.io/nocturne/2026/03/22/doc-sach-quan-sat/"&gt;another&lt;/a&gt; turns the table of contents off and shows an updated date.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is also the &lt;a href="https://tiennm99.github.io/nocturne/archives/"&gt;Archives&lt;/a&gt; page, grouped by year and month, &lt;a href="https://tiennm99.github.io/nocturne/search/"&gt;Search&lt;/a&gt; powered by Pagefind, and the lists of &lt;a href="https://tiennm99.github.io/nocturne/tags/"&gt;tags&lt;/a&gt; and &lt;a href="https://tiennm99.github.io/nocturne/categories/"&gt;categories&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="switching-language-and-theme"&gt;Switching language and theme&lt;/h2&gt;&lt;p&gt;The site comes in Vietnamese and English. The globe button in the top right lists the translations of the page you are on; your pick is remembered, so next time you land straight in that language.&lt;/p&gt;
&lt;p&gt;The moon and sun button next to it switches between dark and light. Dark is the default; pick light and the site remembers it, without a flash of the wrong colours on reload.&lt;/p&gt;
&lt;h2 id="learn-more"&gt;Learn more&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Source code and installation: &lt;a href="https://github.com/tiennm99/nocturne" rel="noopener noreferrer"&gt;github.com/tiennm99/nocturne&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Configuration reference: &lt;a href="https://github.com/tiennm99/nocturne/blob/main/docs/config.md" rel="noopener noreferrer"&gt;docs/config.md&lt;/a&gt;; customization: &lt;a href="https://github.com/tiennm99/nocturne/blob/main/docs/customization.md" rel="noopener noreferrer"&gt;docs/customization.md&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The content of this demo lives in the &lt;a href="https://github.com/tiennm99/nocturne/tree/main/exampleSite" rel="noopener noreferrer"&gt;exampleSite&lt;/a&gt; folder; every post has an &amp;ldquo;Edit this page&amp;rdquo; link that opens its source file.&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>