<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Technical Writing | 空垠尘</title><link>/en/tags/technical-writing/</link><description>Minimalist Static · Boundless Edge</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>Dukang Xu</managingEditor><webMaster>Dukang Xu</webMaster><copyright>© 2026 空垠尘</copyright><lastBuildDate>Wed, 09 Sep 2026 10:00:00 +0800</lastBuildDate><atom:link href="/en/tags/technical-writing/index.xml" rel="self" type="application/rss+xml"/><item><title>Markdown Typography and Advanced Extensions</title><link>/en/markdown-guide/</link><pubDate>Wed, 09 Sep 2026 10:00:00 +0800</pubDate><author>Dukang Xu</author><guid isPermaLink="true">/en/markdown-guide/</guid><description>A comprehensive guide to core Markdown typography standards, bilingual spacing aesthetics, and engineering practices for mathematical equations (LaTeX) and architecture diagrams (Mermaid).</description><content:encoded><![CDATA[<h2 id="introduction-the-elegant-power-of-plain-text">Introduction: The Elegant Power of Plain Text</h2>
<p>In 2004, John Gruber and Aaron Swartz invented Markdown with a clean design goal: &ldquo;<strong>To enable people to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid XHTML or HTML.</strong>&rdquo;</p>
<p>In modern software engineering and technical writing, Markdown has become the de facto universal standard. From GitHub <code>README.md</code> files and technical blog posts to internal system architecture documentation, developers love Markdown for its minimal cognitive load and seamless version-control friendliness.</p>
<p>However, in practice, there is a massive gap between simply &ldquo;writing Markdown&rdquo; and &ldquo;crafting clean, consistent, and highly readable Markdown&rdquo;. This article explores best practices across three core dimensions: <strong>Core Typography Guidelines</strong>, <strong>Spacing and Punctuation Aesthetics</strong>, and <strong>Advanced Extensions (LaTeX Math &amp; Mermaid Diagrams)</strong>.</p>
<hr>
<h2 id="1-core-markdown-typography-guidelines">1. Core Markdown Typography Guidelines</h2>
<h3 id="11-semantic-heading-hierarchy">1.1 Semantic Heading Hierarchy</h3>
<p>Headings serve as the single source of truth for document outlines and Table of Contents (TOC) generation:</p>
<ul>
<li><strong>H1 (<code>#</code>)</strong>: Use only once per article (typically rendered automatically from the frontmatter <code>title</code>);</li>
<li><strong>H2 (<code>##</code>)</strong>: Represents top-level thematic sections;</li>
<li><strong>H3 (<code>###</code>)</strong>: Represents specific sub-modules within a section;</li>
<li><strong>Never skip heading levels</strong>: Jumping directly from <code>##</code> to <code>####</code> breaks automated TOC hierarchies and screen readers.</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="ln">1</span><span class="cl"><span class="cm">&lt;!-- Correct: Strict step-by-step hierarchy --&gt;</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="gu">## 1. Architecture Design Principles
</span></span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="gu">### 1.1 Single Responsibility
</span></span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="gu">### 1.2 Open-Closed
</span></span></span><span class="line"><span class="ln">5</span><span class="cl">
</span></span><span class="line"><span class="ln">6</span><span class="cl"><span class="cm">&lt;!-- Incorrect: Skipping levels breaks structure --&gt;</span>
</span></span><span class="line"><span class="ln">7</span><span class="cl"><span class="gu">## 1. Architecture Design Principles
</span></span></span><span class="line"><span class="ln">8</span><span class="cl"><span class="gu">#### 1.1 Single Responsibility (Skipped H3)
</span></span></span></code></pre></div><hr>
<h3 id="12-list-formatting--indentation">1.2 List Formatting &amp; Indentation</h3>
<p>Lists structure disparate points cleanly. Spacing and indentation are key to maintaining list consistency:</p>
<ul>
<li><strong>Unordered Lists</strong>: Stick to <code>-</code> globally across your articles; avoid mixing <code>*</code>, <code>+</code>, and <code>-</code>;</li>
<li><strong>Nested Indentation</strong>: Indent child lists by <strong>2 or 4 spaces</strong> relative to their parent (2 spaces recommended);</li>
<li><strong>List Spacing</strong>: Keep simple list items compact without blank lines; use loose spacing only when items contain multiple paragraphs or code blocks.</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="ln">1</span><span class="cl"><span class="k">-</span> **Core Middleware Layer**
</span></span><span class="line"><span class="ln">2</span><span class="cl">  <span class="k">-</span> Authentication Guard (JWT / WebAuthn verification)
</span></span><span class="line"><span class="ln">3</span><span class="cl">  <span class="k">-</span> Rate Limiting Middleware (Token Bucket algorithm)
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="k">-</span> **Persistence Layer**
</span></span><span class="line"><span class="ln">5</span><span class="cl">  <span class="k">-</span> SQLite WAL Relational Database
</span></span><span class="line"><span class="ln">6</span><span class="cl">  <span class="k">-</span> Global Read-only KV Cache
</span></span></code></pre></div><hr>
<h3 id="13-code-blocks-and-syntax-highlighting">1.3 Code Blocks and Syntax Highlighting</h3>
<p>Code blocks are central to technical documentation:</p>
<ol>
<li><strong>Explicit Language Identifiers</strong>: Always declare language identifiers (e.g. <code>go</code>, <code>typescript</code>, <code>rust</code>, <code>bash</code>, <code>json</code>, <code>sql</code>) after the opening triple backticks. This triggers Chroma syntax highlighting, displays language badges, and powers one-click copy buttons;</li>
<li><strong>Inline vs. Block Code</strong>:
<ul>
<li>File paths (<code>/etc/hosts</code>), flags (<code>--minify</code>), and identifiers (<code>userToken</code>) belong in single backticks;</li>
<li>Multi-line snippets belong in standalone fenced code blocks.</li>
</ul>
</li>
</ol>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-typescript" data-lang="typescript"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1">// Explicit language tag: typescript
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="kr">interface</span> <span class="nx">UserSession</span> <span class="p">{</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">  <span class="nx">userId</span>: <span class="kt">string</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">  <span class="nx">role</span><span class="o">:</span> <span class="s2">&#34;admin&#34;</span> <span class="o">|</span> <span class="s2">&#34;member&#34;</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">5</span><span class="cl">  <span class="nx">expiresAt</span>: <span class="kt">number</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">6</span><span class="cl"><span class="p">}</span>
</span></span></code></pre></div><hr>
<h3 id="14-blockquote-hierarchy">1.4 Blockquote Hierarchy</h3>
<p>Blockquotes highlight quotations, important notices, core conclusions, or architectural axioms:</p>
<blockquote>
<p><strong>Core Design Principle</strong>:</p>
<p>&ldquo;Simplicity is prerequisite for reliability. The best code is often the code you didn&rsquo;t have to write.&rdquo;</p>
<blockquote>
<p><em>— Edsger W. Dijkstra</em></p>
</blockquote>
</blockquote>
<hr>
<h2 id="2-punctuation--spacing-aesthetics">2. Punctuation &amp; Spacing Aesthetics</h2>
<p>Professional documentation pays meticulous attention to subtle typographic details:</p>
<ol>
<li><strong>Spacing Between Scripts</strong>: Maintain clean spacing when mixing different scripts (e.g. Latin letters and CJK characters);</li>
<li><strong>Punctuation Accuracy</strong>: Use standard punctuation consistent with the primary sentence language;</li>
<li><strong>Emphasis Flanking</strong>: Ensure bold (<code>**word**</code>) and italic (<code>*word*</code>) markers hug content without broken inner whitespace.</li>
</ol>
<hr>
<h2 id="3-advanced-markdown-extensions-in-action">3. Advanced Markdown Extensions in Action</h2>
<p>By embedding KaTeX and Mermaid renderers, a pure static blog can natively render intricate mathematical equations and software architecture diagrams without relying on static images.</p>
<h3 id="31-native-latex--katex-mathematical-typesetting">3.1 Native LaTeX / KaTeX Mathematical Typesetting</h3>
<p>Write standard LaTeX directly in Markdown for crisp, high-resolution formula rendering.</p>
<h4 id="inline-math">Inline Math</h4>
<p>Wrap inline formulas with single dollar signs <code>$</code>:</p>
<ul>
<li>Mass-energy equivalence: $E = mc^2$</li>
<li>Euler&rsquo;s identity: $e^{i\pi} + 1 = 0$</li>
<li>Normal distribution PDF: $f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$</li>
</ul>
<h4 id="display-math-block-equations">Display Math (Block Equations)</h4>
<p>Wrap standalone equation blocks with double dollar signs <code>$$</code>:</p>
<ul>
<li>
<p><strong>Gaussian Integral</strong>:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$</p>
</li>
<li>
<p><strong>Discrete Fourier Transform (DFT)</strong>:
$$
X_k = \sum_{n=0}^{N-1} x_n \cdot e^{-i \frac{2\pi}{N} k n} \quad (k = 0, 1, \dots, N-1)
$$</p>
</li>
<li>
<p><strong>Maxwell&rsquo;s Equations (Differential Form)</strong>:
$$
\begin{aligned}
\nabla \cdot \mathbf{E} &amp;= \frac{\rho}{\varepsilon_0} \
\nabla \cdot \mathbf{B} &amp;= 0 \
\nabla \times \mathbf{E} &amp;= -\frac{\partial \mathbf{B}}{\partial t} \
\nabla \times \mathbf{B} &amp;= \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t}
\end{aligned}
$$</p>
</li>
</ul>
<hr>
<h3 id="32-mermaid-vector-flowcharts--sequence-diagrams">3.2 Mermaid Vector Flowcharts &amp; Sequence Diagrams</h3>
<p>Declare <code>```mermaid</code> code blocks, and the browser dynamically renders responsive vector SVGs matching light/dark themes.</p>
<h4 id="modern-edge-architecture-flow-graph-lr">Modern Edge Architecture Flow (<code>graph LR</code>)</h4>
<pre tabindex="0"><code class="language-mermaid" data-lang="mermaid">flowchart LR
    Client[&#34;Client Browser&#34;] --&gt;|&#34;HTTPS / HTTP/3&#34;| CDN[&#34;Cloudflare Edge Network&#34;]
    CDN --&gt;|&#34;Cache Hit (&amp;lt; 10ms)&#34;| EdgeCache[&#34;Edge Cache&#34;]
    CDN --&gt;|&#34;Cache Miss&#34;| Pages[&#34;Cloudflare Pages Static Delivery&#34;]
    Pages --&gt;|&#34;Pure Markdown&#34;| Storage[&#34;Markdown Content&#34;]
</code></pre><h4 id="oauth-21-pkce-state-machine-sequence-sequencediagram">OAuth 2.1 PKCE State Machine Sequence (<code>sequenceDiagram</code>)</h4>
<pre tabindex="0"><code class="language-mermaid" data-lang="mermaid">sequenceDiagram
    autonumber
    actor User as User
    participant Client as Frontend Client
    participant Authz as Authz Server
    participant API as Resource API

    User-&gt;&gt;Client: Click Passkey Login
    Client-&gt;&gt;Client: Generate code_verifier and challenge
    Client-&gt;&gt;Authz: Initiate Auth Request /authorize
    Authz-&gt;&gt;User: Prompt WebAuthn biometric check
    User--&gt;&gt;Authz: Biometric signature verified
    Authz--&gt;&gt;Client: Return Authorization Code
    Client-&gt;&gt;Authz: Exchange Token /token
    Authz-&gt;&gt;Authz: Verify SHA256 matches challenge
    Authz--&gt;&gt;Client: Issue JWT Access Token
    Client-&gt;&gt;API: Fetch data with Bearer Token
    API--&gt;&gt;Client: 200 OK Return Protected Resource
</code></pre><hr>
<h2 id="4-conclusion-the-docs-as-code-philosophy">4. Conclusion: The &ldquo;Docs as Code&rdquo; Philosophy</h2>
<p>In modern software engineering, the <strong>Docs as Code</strong> paradigm offers major advantages:</p>
<ol>
<li><strong>Version Control</strong>: Documentation lives alongside source code in Git, making every iteration auditable;</li>
<li><strong>Standardized Governance</strong>: Consistent guidelines ensure high-quality knowledge assets across teams;</li>
<li><strong>Decoupled Presentation</strong>: Clean Markdown focuses entirely on content rigor, leaving visual rendering to static site engines.</li>
</ol>
<p>Adopting disciplined Markdown conventions makes every article clearer to write and a pleasure to read.</p>
]]></content:encoded><category>Markdown</category><category>Typography</category><category>LaTeX</category><category>Mermaid</category><category>Technical Writing</category></item></channel></rss>