Documentation Site on GitHub Pages (#2376)

* Add initial documentations

* Update documentation for Basic Client and add WebSocket section

* feat: add a static site generator with multi-language support

- Introduced a new Rust-based static site generator in the `docs-gen` directory.
- Implemented core functionality for building sites from markdown files, including:
  - Configuration loading from `config.toml`.
  - Markdown rendering with frontmatter support.
  - Navigation generation based on page structure.
  - Static file copying and output directory management.
- Added templates for base layout, pages, and portal.
- Created a CSS file for styling and a JavaScript file for interactive features like language selection and theme toggling.
- Updated documentation source with new configuration and example pages in English and Japanese.
- Added a `justfile` target for building the documentation site.

* Add language/theme toggle functionality

- Created a new Japanese tour index page at docs/ja/tour/index.html
- Implemented navigation links for various sections of the cpp-httplib tutorial
- Added a language selector to switch between English and Japanese
- Introduced theme toggle functionality to switch between light and dark modes
- Added mobile sidebar toggle for better navigation on smaller screens
This commit is contained in:
yhirose
2026-02-28 14:45:40 -05:00
committed by GitHub
parent 85b18a9c64
commit 797758a742
66 changed files with 12361 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ page.title }} - {{ site.title }}</title>
<link rel="stylesheet" href="/css/main.css">
<script>
(function() {
var t = localStorage.getItem('preferred-theme');
if (!t) t = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
if (t === 'light') document.documentElement.setAttribute('data-theme', 'light');
})();
</script>
</head>
<body>
<header class="header">
<div class="header-inner">
<a href="/{{ lang }}/" class="header-title">{{ site.title }}{% if site.version %} <span style="font-size:0.75em;font-weight:normal;margin-left:4px">v{{ site.version }}</span>{% endif %}</a>
<div class="header-spacer"></div>
<nav class="header-nav">
<a href="/{{ lang }}/">Home</a>
<a href="/{{ lang }}/tour/">Tour</a>
</nav>
<div class="header-tools">
<button class="theme-toggle" aria-label="Toggle theme"></button>
<div class="lang-selector">
<button class="lang-btn" aria-label="Language">{{ lang | upper }}</button>
<ul class="lang-popup">
{% for l in site.langs %}
<li><a href="#" data-lang="{{ l }}">{{ l | upper }}</a></li>
{% endfor %}
</ul>
</div>
</div>
{% block sidebar_toggle %}{% endblock %}
</div>
</header>
{% if page.status == "draft" %}
<div class="draft-banner">DRAFT</div>
{% endif %}
<div class="layout {% block layout_class %}{% endblock %}">
{% block body %}{% endblock %}
</div>
<footer class="footer">
&copy; 2026 yhirose. All rights reserved.
</footer>
<script src="/js/main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block layout_class %}has-sidebar{% endblock %}
{% block sidebar_toggle %}<button class="sidebar-toggle" aria-label="Menu">&#9776;</button>{% endblock %}
{% block body %}
<aside class="sidebar">
<nav class="sidebar-nav">
{% for section in nav %}
<div class="nav-section">
<a href="{{ section.url }}" class="nav-section-title {% if section.active %}active{% endif %}">{{ section.title }}</a>
{% if section.children %}
<ul class="nav-list">
{% for item in section.children %}
<li><a href="{{ item.url }}" class="{% if item.active %}active{% endif %}">{{ item.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endfor %}
</nav>
</aside>
<main class="content">
<article>
<h1>{{ page.title }}</h1>
{{ content | safe }}
</article>
</main>
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block layout_class %}no-sidebar{% endblock %}
{% block body %}
<main class="content portal">
<article>
<h1>{{ page.title }}</h1>
{{ content | safe }}
</article>
</main>
{% endblock %}