#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
"""docs/MANUAL.md -> docs/guide/manual.html, docs/MANUAL.es.md -> docs/guide/manual.es.html.
One self-contained page per language (images inlined, works offline once downloaded): a table of contents from the
headings (beside the text on wide screens, folded on a phone), an "essential commands" card at the top, the EN/ES
switch and a Download link. Needs `pip install markdown`.
python3 tools/gen_manual_html.py
"""
import base64
import html
import mimetypes
import os
import re
from pathlib import Path
import markdown
ROOT = Path(__file__).resolve().parent.parent
DOCS = ROOT / "docs"
OUT = DOCS / "guide"
# The commands everyone needs, taken from the manual and docs/cheatsheet/controls.html (V10.8.21).
ESSENTIAL = {
"en": ("Essential commands", [
("Navigate", [
("HOME EDIT SEQ FX GLO ENV LFO SCL ARP SAVE",
"From elsewhere: the page you were last on in that section. Already inside: the first page of the next group."),
("SELECT", "Walks every page of the section, a page a detent."),
("ALGORITHM", "Picks the track (T1–T4, or T1–T6 with TRACKS 6)."),
("PRESETS", "Always presets: the track's sounds. SEQ: the patterns. On SEQ › STEP FX it picks the step."),
("KNOB 1–4", "The four cards on screen. KNOB 1 picks (step, bar, slot, row)."),
("HOME held", "The MENU."),
]),
("Play and record", [
("PLAY", "Start / stop. Held about 0.7 s: PANIC, all notes off."),
("GLO + PLAY", "Restart from the top."),
("REC", "Arms live recording on the selected track. Held alone and let go: UNDO (again: redo)."),
("OCT− OCT+", "Keyboard octave; both together: back to 0. On action pages and dialogs: back / confirm."),
("GLO + SELECT", "Tempo, from any page."),
]),
("Hold a button (layers and combos)", [
("FX held", "Punch-in effects on the keys."),
("LFO held", "MACRO layer: KNOB 1–4 are M1–M4."),
("SCL held", "The keys set the root."),
("HOME + SELECT", "The GENERATOR."),
("EDIT + SELECT", "The sound dice (OCT+ keeps, OCT− cancels)."),
("EDIT + PRESETS", "The first sound of the next / previous engine."),
("GLO + G4", "UNDO the last big change."),
("SEQ + G5", "Clear the cursor step."),
("SAVE + C5", "NAME: rename."),
("SEQ + REC", "Clear all sequences (asks first)."),
]),
("New in V10.8.21", [
("HOME › JAM", "Keys F3–B3 pick A–D on every track, OCT+ go, OCT− stop, REC records a take, K4 LOCK plays it."),
("SEQ › STEP FX", "Hold a white key: a step component plays; with REC it is written into the step."),
("SEQ › CLAY", "DRONE CLAY: a low drone and four modulators per track."),
]),
("Power-on", [
("OCT− + OCT+ at power-on", "Hardware calibration."),
("OCT− + OCT+ held 5 s", "Update mode (let go to cancel)."),
]),
]),
"es": ("Comandos esenciales", [
("Navegar", [
("HOME EDIT SEQ FX GLO ENV LFO SCL ARP SAVE",
"Desde otra sección: la última página que viste ahí. Ya adentro: la primera página del grupo siguiente."),
("SELECT", "Recorre todas las páginas de la sección, una por paso."),
("ALGORITHM", "Elige la pista (T1–T4, o T1–T6 con TRACKS 6)."),
("PRESETS", "Siempre presets: los sonidos de la pista. En SEQ: los patrones. En SEQ › STEP FX elige el paso."),
("KNOB 1–4", "Las cuatro tarjetas de la pantalla. KNOB 1 elige (paso, compás, slot, fila)."),
("HOME mantenido", "El MENU."),
]),
("Tocar y grabar", [
("PLAY", "Arranca / para. Mantenido unos 0,7 s: PANIC, corta todas las notas."),
("GLO + PLAY", "Vuelve al principio."),
("REC", "Arma la grabación en vivo de la pista elegida. Mantenido solo y soltado: UNDO (otra vez: rehace)."),
("OCT− OCT+", "Octava del teclado; las dos juntas: vuelve a 0. En páginas de acción y diálogos: atrás / confirmar."),
("GLO + SELECT", "El tempo, desde cualquier página."),
]),
("Mantener un botón (capas y combinaciones)", [
("FX mantenido", "Efectos punch-in en las teclas."),
("LFO mantenido", "Capa MACRO: KNOB 1–4 son M1–M4."),
("SCL mantenido", "Las teclas eligen la tónica."),
("HOME + SELECT", "El GENERATOR."),
("EDIT + SELECT", "El dado de sonido (OCT+ lo deja, OCT− lo cancela)."),
("EDIT + PRESETS", "El primer sonido del motor siguiente / anterior."),
("GLO + G4", "UNDO del último cambio grande."),
("SEQ + G5", "Borra el paso del cursor."),
("SAVE + C5", "NAME: cambiar el nombre."),
("SEQ + REC", "Borra todas las secuencias (pregunta antes)."),
]),
("Nuevo en V10.8.21", [
("HOME › JAM", "Las teclas F3–B3 eligen A–D en todas las pistas, OCT+ lanza, OCT− para, REC graba una toma, K4 LOCK la reproduce."),
("SEQ › STEP FX", "Mantené una tecla blanca: suena un componente de paso; con REC queda grabado en el paso."),
("SEQ › CLAY", "DRONE CLAY: un drone grave y cuatro moduladores por pista."),
]),
("Al encender", [
("OCT− + OCT+ al encender", "Calibración del hardware."),
("OCT− + OCT+ mantenidos 5 s", "Modo de actualización (soltá para cancelar)."),
]),
]),
}
UI = {
"en": {"title": "JIANT FM — User Manual", "toc": "Contents", "dl": "Download", "other": ("Español", "manual.es.html"),
"new": ("What's new in V10.8.21", "whats-new-v10.8.21.html"), "self": "manual.html"},
"es": {"title": "JIANT FM — Manual de uso", "toc": "Índice", "dl": "Descargar", "other": ("English", "manual.html"),
"new": ("Lo nuevo en V10.8.21", "whats-new-v10.8.21.es.html"), "self": "manual.es.html"},
}
CSS = """
:root{--bg:#050409;--surf:#0b0912;--raise:#100e18;--line:rgba(239,230,200,.14);--fg:#efe6c8;--mid:#c9c1d8;--dim:#a39bb6;
--accent:#ff7a1a;--vio:#b870ff;--cyan:#3fe0e6;--heat:linear-gradient(90deg,#6b5cff,#b870ff 35%,#ff4bb0 60%,#ff7a1a 85%,#ffd34d);
--display:"Michroma","Segoe UI",system-ui,sans-serif;--body:"Instrument Sans",system-ui,sans-serif;--mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;color-scheme:dark}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--body);font-size:16px;line-height:1.65;
background-image:radial-gradient(900px 420px at 85% -120px,rgba(184,112,255,.16),transparent 70%),radial-gradient(700px 360px at -10% 0,rgba(255,122,26,.08),transparent 70%);background-repeat:no-repeat}
.top{position:sticky;top:0;z-index:5;background:rgba(5,4,9,.86);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
.top .in{max-width:1240px;margin:0 auto;padding:12px max(16px,env(safe-area-inset-left,0px));display:flex;align-items:center;gap:14px 22px;flex-wrap:wrap}
.brand{font-family:var(--display);font-size:17px;letter-spacing:.04em;color:var(--fg);text-decoration:none;white-space:nowrap}
.brand b{font-weight:400;background:var(--heat);-webkit-background-clip:text;background-clip:text;color:transparent}
.brand small{font-family:var(--mono);font-size:10px;letter-spacing:.2em;color:var(--dim);margin-left:8px;text-transform:uppercase}
.docs{display:flex;gap:4px;flex-wrap:wrap}
.docs a{font-family:var(--mono);font-size:12px;letter-spacing:.06em;color:var(--dim);text-decoration:none;padding:6px 10px;border:1px solid transparent;border-radius:8px}
.docs a:hover{color:var(--fg)}
.docs a[aria-current="page"]{color:var(--fg);border-color:var(--line);background:var(--surf)}
.layout{max-width:1240px;margin:0 auto;padding-block:28px 72px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:grid;grid-template-columns:270px minmax(0,1fr);gap:44px}
@media (max-width:900px){.layout{grid-template-columns:minmax(0,1fr);gap:16px}}
nav.toc{position:sticky;top:76px;align-self:start;max-height:calc(100vh - 96px);overflow:auto;font-size:14px;padding-right:12px}
@media (max-width:900px){nav.toc{position:static;max-height:none;padding-right:0}}
nav.toc details{border:1px solid var(--line);border-radius:12px;padding:10px 14px;background:var(--surf)}
nav.toc summary{cursor:pointer;font-family:var(--mono);font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--cyan)}
nav.toc ul{list-style:none;margin:8px 0 0;padding-left:0}
nav.toc ul ul{padding-left:12px;border-left:1px solid var(--line);margin:2px 0 6px 2px}
nav.toc a{color:var(--dim);text-decoration:none;display:block;padding:3px 0;line-height:1.35}
nav.toc a:hover,nav.toc a:focus-visible,nav.toc a.here{color:var(--fg)}
nav.toc a.here{box-shadow:inset 2px 0 0 var(--accent);padding-left:8px}
main{min-width:0;max-width:840px}
.hero{position:relative;padding:26px 26px 22px;margin:0 0 26px;border:1px solid var(--line);border-radius:16px;background:linear-gradient(180deg,rgba(184,112,255,.07),transparent 70%),var(--surf);overflow:hidden}
.hero::after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--heat);opacity:.8}
.eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.22em;text-transform:uppercase;color:var(--cyan);margin:0 0 10px}
.hero h1{margin:0 0 10px}
.hero .lead{color:var(--mid);margin:0 0 16px;max-width:64ch}
.hero img.shot{display:block;width:100%;margin:6px 0 16px;border:1px solid var(--line);border-radius:10px}
.bar{display:flex;flex-wrap:wrap;gap:8px}
.btn{font-family:var(--body);font-weight:600;font-size:14px;text-decoration:none;color:var(--fg);border:1px solid var(--line);background:var(--raise);border-radius:10px;padding:8px 14px}
.btn.go{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.btn:hover,.btn:focus-visible{border-color:var(--accent);outline:none}
h1,h2,h3,h4{font-family:var(--display);font-weight:400;line-height:1.2;text-wrap:balance;scroll-margin-top:84px;letter-spacing:.01em}
h1{font-size:clamp(26px,4.6vw,42px)}
h1 .fm{background:var(--heat);-webkit-background-clip:text;background-clip:text;color:transparent}
main>h1:first-of-type{display:none}
h2{font-size:clamp(19px,2.6vw,25px);margin:56px 0 14px;padding-top:18px;border-top:1px solid var(--line);position:relative}
h2::before{content:"";position:absolute;top:-1px;left:0;width:56px;height:2px;background:var(--heat)}
h3{font-size:17px;margin:34px 0 8px;color:var(--fg)}
h4{font-size:14px;margin:24px 0 6px;color:var(--mid);font-family:var(--mono);letter-spacing:.08em;text-transform:uppercase}
p,li{max-width:74ch}
li{margin:3px 0}
strong{color:#fff3ce;font-weight:600}
a{color:var(--vio);text-underline-offset:3px}
a:hover{color:var(--accent)}
code,kbd{font-family:var(--mono);font-size:.86em}
code{background:var(--raise);border:1px solid var(--line);border-radius:5px;padding:1px 5px;color:#fff3ce}
kbd{background:#16131f;border:1px solid rgba(255,122,26,.45);border-bottom-width:2px;border-radius:6px;padding:0 6px;white-space:nowrap;color:#ffd9b8}
.tw{overflow-x:auto;margin:14px 0;border:1px solid var(--line);border-radius:12px;background:var(--surf)}
table{border-collapse:collapse;width:100%;font-size:14px}
th,td{text-align:left;padding:9px 12px;border-bottom:1px solid var(--line);vertical-align:top}
tr:last-child td{border-bottom:0}
th{font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--cyan);font-weight:500;background:rgba(63,224,230,.04)}
tbody tr:hover td{background:rgba(184,112,255,.05)}
img{max-width:100%;height:auto;border-radius:10px}
pre{overflow-x:auto;background:var(--surf);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
pre code{background:none;border:0;padding:0;color:var(--mid)}
blockquote{margin:14px 0;padding:10px 16px;border-left:3px solid var(--vio);background:rgba(184,112,255,.06);border-radius:0 10px 10px 0;color:var(--mid)}
blockquote p{margin:4px 0}
hr{border:0;border-top:1px solid var(--line);margin:36px 0}
.ess{position:relative;background:var(--surf);border:1px solid var(--line);border-radius:16px;padding:20px 22px;margin:8px 0 26px}
.ess h2{margin:0 0 8px;border:0;padding:0}
.ess h2::before{display:none}
.ess h3{font-size:12px;margin:18px 0 8px;color:var(--cyan);font-family:var(--mono);letter-spacing:.16em;text-transform:uppercase}
.ess dl{display:grid;grid-template-columns:minmax(0,260px) minmax(0,1fr);gap:8px 18px;margin:0}
.ess dt{min-width:0}
.ess dd{margin:0;min-width:0;color:var(--mid)}
@media (max-width:600px){.ess dl{grid-template-columns:minmax(0,1fr)}.ess dd{margin-bottom:8px}}
@media (max-width:640px){.top{position:static}nav.toc{top:12px}h1,h2,h3,h4{scroll-margin-top:12px}}
footer{max-width:1240px;margin:0 auto;padding:24px 16px 40px;color:var(--dim);font-size:13px;border-top:1px solid var(--line)}
footer a{color:var(--dim)}
@media print{.top,nav.toc,.bar{display:none}.layout{display:block}body{background:#fff;color:#000}}
"""
# every manual (the docs nav): key, page, label, the source; the ports' docs are in English
STUDIO = "https://juanjiant-bit.github.io/JIANT/studio/"
GH = "https://github.com/juanjiant-bit/JIANT/blob/main/"
PAGES = [
("fm", "manual.html", "JIANT FM · FM-1"),
("smk37", "smk37.html", "SMK-37"),
("mpc", "mpc-sample.html", "MPC Sample"),
("ports", "ports.html", "MPC plugin · ports"),
("plugin", "plugin.html", "VST3 · AU · LV2"),
]
# a source's .md the other pages are made from (links between them stay inside the manuals)
MD_PAGE = {"docs/MANUAL.md": "manual.html", "docs/MANUAL.es.md": "manual.es.html", "docs/SMK37.md": "smk37.html",
"ports/mpc-sample/README.md": "mpc-sample.html", "ports/README.md": "ports.html",
"ports/juce-plugin/README.md": "plugin.html"}
PORT_DOCS = {
"smk37": dict(src="docs/SMK37.md", eyebrow="Manual · M-VAVE SMK-37 Pro / Elite", shot="smk37.webp",
title='JIANT FM on the SMK-37',
lead="JIANT bare metal on the SMK-37's own chip (the FM-1's AC791N): 37 keys, 16 RGB pads, 8 encoders and 4 faders as its panel, the same web editor and the same sounds. In development.",
links=[("Try it in the browser", "https://juanjiant-bit.github.io/JIANT/emu/devices.html#smk37"), ("JIANT Studio", STUDIO + "#ports")]),
"mpc": dict(src="ports/mpc-sample/README.md", eyebrow="Manual · Akai MPC Sample", shot="mpc.webp",
title='JIANT FM on the MPC Sample',
lead="JIANT as the MPC Sample's whole instrument, started from the microSD card: its screen, pads, buttons and knobs as the FM-1's panel, with the SAMPLE and GRAIN engines, DRUM-X with samples and 16 sample slots. Preview: testers wanted.",
links=[("Download", "https://github.com/juanjiant-bit/JIANT/releases"), ("Try it in the browser", "https://juanjiant-bit.github.io/JIANT/emu/devices.html#mpc"), ("JIANT Studio", STUDIO + "#ports")]),
"ports": dict(src="ports/README.md", eyebrow="Manual · the ports and the MPC plugin (coming soon)", shot="mpc-plugin.webp",
title='JIANT FM beyond the FM-1',
lead="The same firmware from the same sources on other machines: the MPC plugin for the MPC standalones (MPC OS 3.10.1+) and desktop VST2 hosts, the MPC Sample app, the desktop plugins. A song sounds the same on every one.",
links=[("JIANT Studio", STUDIO + "#ports")]),
"plugin": dict(src="ports/juce-plugin/README.md", eyebrow="Coming soon · VST3 · AU · AUv3 · LV2 · app", shot="plugin.webp",
title='JIANT FM in your DAW',
lead="For your DAW or the iPad (AUM, GarageBand, Logic, Cubasis…), with an editor made for a DAW: the live screen, the six tracks, each sound's presets and parameters, and a sample browser with drag and drop.",
links=[("JIANT Studio", STUDIO + "#ports")]),
}
def gh_slug(value, separator="-"):
"""GitHub's heading ids (the manual's links are written for GitHub): lowercase, accents and other letters kept,
punctuation (› · , . : ( ) …) dropped, each space a hyphen."""
value = re.sub(r"[^\w\- ]", "", value.strip().lower(), flags=re.UNICODE)
return value.replace(" ", separator)
def topbar(current, lang="en"):
cur = ' aria-current="page"'
docs = "".join(f'{html.escape(t)}' for k, href, t in PAGES)
word = "Manuales" if lang == "es" else "Manuals"
return (f'{title}
']
for g, rows in groups:
out.append(f"{g}
")
for k, v in rows:
out.append(f"
")
out.append("
{"Manual de uso · M-VAVE FM-1" if es else "User manual · M-VAVE FM-1"}
{"Todo JIANT FM en una página: cada botón, perilla y mensaje con el nombre que muestra el aparato. Si leés un solo capítulo, que sea Guardar y cargar." if es else "All of JIANT FM on one page: every button, knob and message named as the device shows it. If you read one chapter, read Saving and loading."}
{html.escape(d["eyebrow"])}
{html.escape(d["lead"])}
{img}