Skip to content

Commit b5f8d17

Browse files
taylorarndtCopilot
andcommitted
fix: add heading IDs to HTML build so TOC anchor links work on GitHub Pages
marked was rendering headings without id attributes, breaking all same-page anchor links in table of contents sections. Added a custom heading renderer using GitHub's anchor algorithm (lowercase, strip punctuation, spaces to hyphens). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bdfa0da commit b5f8d17

File tree

125 files changed

+7947
-8568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+7947
-8568
lines changed

html/ACCESSIBILITY_TESTING.html

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

html/BUILD.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@
5858
</div>
5959
</header>
6060
<main id="main-content" class="markdown-body">
61-
<h1>HTML Documentation Build System</h1>
61+
<h1 id="html-documentation-build-system">HTML Documentation Build System</h1>
6262
<p>This repository converts all Markdown files to accessible HTML. The HTML output is committed alongside the Markdown source so that both formats are always in sync.</p>
63-
<h2>Quick Start</h2>
64-
<h3>View HTML Documentation</h3>
63+
<h2 id="quick-start">Quick Start</h2>
64+
<h3 id="view-html-documentation">View HTML Documentation</h3>
6565
<p>All HTML files live in the <code>html/</code> directory:</p>
6666
<ul>
6767
<li>Open <code>html/index.html</code> in your browser for the homepage</li>
6868
<li>Browse the <code>html/docs/</code> folder for chapter and appendix pages</li>
6969
<li>All internal links between documents are preserved</li>
7070
</ul>
71-
<h3>Build Commands</h3>
71+
<h3 id="build-commands">Build Commands</h3>
7272
<pre><code class="hljs language-bash"><span class="hljs-comment"># Install dependencies (first time only)</span>
7373
npm install
7474

@@ -80,7 +80,7 @@ <h3>Build Commands</h3>
8080

8181
<span class="hljs-comment"># Clean generated files</span>
8282
npm run clean</code></pre>
83-
<h2>How It Works</h2>
83+
<h2 id="how-it-works">How It Works</h2>
8484
<p>The build is run <strong>locally</strong> before committing. There is no CI pipeline - you build the HTML yourself and commit both the <code>.md</code> source and the <code>html/</code> output in the same commit.</p>
8585
<p><strong>Typical workflow:</strong></p>
8686
<ol>
@@ -89,15 +89,15 @@ <h2>How It Works</h2>
8989
<li>Stage and commit everything: <code>git add -A &amp;&amp; git commit -m &quot;docs: update chapter 6 and rebuild HTML&quot;</code></li>
9090
<li>Push</li>
9191
</ol>
92-
<h3>What Gets Converted</h3>
92+
<h3 id="what-gets-converted">What Gets Converted</h3>
9393
<ul>
9494
<li><code>docs/*.md</code><code>html/docs/*.html</code></li>
9595
<li><code>learning-room/**/*.md</code><code>html/learning-room/**/*.html</code></li>
9696
<li><code>README.md</code><code>html/index.html</code></li>
9797
<li><code>CONTRIBUTING.md</code><code>html/CONTRIBUTING.html</code></li>
9898
<li>All other root-level <code>.md</code> files</li>
9999
</ul>
100-
<h3>HTML Features</h3>
100+
<h3 id="html-features">HTML Features</h3>
101101
<p><strong>Style and Layout:</strong></p>
102102
<ul>
103103
<li>GitHub-flavored Markdown styling (familiar appearance)</li>
@@ -120,17 +120,17 @@ <h3>HTML Features</h3>
120120
<li>Footer with return link</li>
121121
<li>Preserves all internal links between documents</li>
122122
</ul>
123-
<h2>Configuration Files</h2>
123+
<h2 id="configuration-files">Configuration Files</h2>
124124
<ul>
125125
<li><strong>Build script:</strong> <code>scripts/build-html.js</code> - Conversion logic</li>
126126
<li><strong>Dependencies:</strong> <code>package.json</code> - Node.js packages (marked, highlight.js, etc.)</li>
127127
</ul>
128-
<h2>Customization</h2>
129-
<h3>Modify Styling</h3>
128+
<h2 id="customization">Customization</h2>
129+
<h3 id="modify-styling">Modify Styling</h3>
130130
<p>Edit <code>scripts/build-html.js</code> and look for the <code>customCss</code> constant to add custom styles.</p>
131-
<h3>Change HTML Template</h3>
131+
<h3 id="change-html-template">Change HTML Template</h3>
132132
<p>Edit the <code>htmlTemplate</code> function in <code>scripts/build-html.js</code> to modify the page structure.</p>
133-
<h3>Update Dependencies</h3>
133+
<h3 id="update-dependencies">Update Dependencies</h3>
134134
<pre><code class="hljs language-bash"><span class="hljs-comment"># Check for updates</span>
135135
npm outdated
136136

@@ -140,8 +140,8 @@ <h3>Update Dependencies</h3>
140140
<span class="hljs-comment"># Commit package.json changes</span>
141141
git add package.json
142142
git commit -m <span class="hljs-string">&quot;chore: update HTML build dependencies&quot;</span></code></pre>
143-
<h2>Troubleshooting</h2>
144-
<h3>Local Build Errors</h3>
143+
<h2 id="troubleshooting">Troubleshooting</h2>
144+
<h3 id="local-build-errors">Local Build Errors</h3>
145145
<p><strong>&quot;Cannot find module &#39;marked&#39;&quot;</strong>
146146
→ Run <code>npm install</code> first</p>
147147
<p><strong>&quot;Permission denied&quot; errors</strong>
@@ -150,16 +150,16 @@ <h3>Local Build Errors</h3>
150150
→ Clear browser cache and reload</p>
151151
<p><strong>Watch mode not detecting changes</strong>
152152
→ Ensure you&#39;re saving files (Ctrl+S in VS Code)</p>
153-
<h3>HTML Files Not Appearing in Git</h3>
153+
<h3 id="html-files-not-appearing-in-git">HTML Files Not Appearing in Git</h3>
154154
<p>Check <code>.gitignore</code> to ensure <code>html/</code> is NOT listed there. The <code>html/</code> directory must be tracked by Git so the built output is always available in the repository.</p>
155-
<h2>For Contributors</h2>
155+
<h2 id="for-contributors">For Contributors</h2>
156156
<p>When submitting pull requests:</p>
157157
<ul>
158158
<li><strong>Edit the Markdown files</strong>, then run <code>npm run build:html</code></li>
159159
<li><strong>Include both</strong> the <code>.md</code> changes and the updated <code>html/</code> files in your commit</li>
160160
<li>If you forget to rebuild, a reviewer will ask you to run the build before merging</li>
161161
</ul>
162-
<h2>Additional Resources</h2>
162+
<h2 id="additional-resources">Additional Resources</h2>
163163
<ul>
164164
<li><a href="https://marked.js.org/">marked documentation</a> - Markdown parser</li>
165165
<li><a href="https://highlightjs.org/">highlight.js documentation</a> - Syntax highlighting</li>

0 commit comments

Comments
 (0)