docs: ensure config correctness and improve documentation checker
- commit
- 9d5a501655aa210ee705b86e7038c7626552a66b
- author
- brice · · 2025-12-22 21:41 UTC
- committer
- brice · · 2025-12-22 20:28 UTC
- parent
- b9b46e5
- signature
- unsigned
2 files · +50 -9
M dev/check-docs.go +32 -4
| @@ -436,6 +436,7 @@ func verifyConfigDoc(report *Report, schemaKeys map[string]struct{}, configDocPa | |||
| 436 | 436 | ||
| 437 | 437 | func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]int { | |
| 438 | 438 | keyRe := regexp.MustCompile("`([a-zA-Z0-9_.-]+)`") | |
| 439 | + | tableRowRe := regexp.MustCompile(`^\|`) | |
| 439 | 440 | inCode := false | |
| 440 | 441 | ||
| 441 | 442 | seen := map[string]int{} | |
| @@ -448,6 +449,35 @@ func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]i | |||
| 448 | 449 | if inCode { | |
| 449 | 450 | continue | |
| 450 | 451 | } | |
| 452 | + | ||
| 453 | + | // Prefer extracting keys from the first column of Markdown tables. | |
| 454 | + | // This avoids false-positives from enum values shown in other columns. | |
| 455 | + | if tableRowRe.MatchString(trim) { | |
| 456 | + | // Skip table separator rows. | |
| 457 | + | if strings.Contains(trim, "---") { | |
| 458 | + | continue | |
| 459 | + | } | |
| 460 | + | parts := strings.Split(line, "|") | |
| 461 | + | if len(parts) >= 3 { | |
| 462 | + | firstCell := strings.TrimSpace(parts[1]) | |
| 463 | + | matches := keyRe.FindAllStringSubmatch(firstCell, -1) | |
| 464 | + | for _, m := range matches { | |
| 465 | + | k := m[1] | |
| 466 | + | if k == "" || k[0] < 'a' || k[0] > 'z' { | |
| 467 | + | continue | |
| 468 | + | } | |
| 469 | + | if strings.ContainsAny(k, " /") { | |
| 470 | + | continue | |
| 471 | + | } | |
| 472 | + | if _, already := seen[k]; !already { | |
| 473 | + | seen[k] = i + 1 | |
| 474 | + | } | |
| 475 | + | } | |
| 476 | + | } | |
| 477 | + | continue | |
| 478 | + | } | |
| 479 | + | ||
| 480 | + | // Outside of tables, only accept dotted paths that look like config keys. | |
| 451 | 481 | matches := keyRe.FindAllStringSubmatch(line, -1) | |
| 452 | 482 | for _, m := range matches { | |
| 453 | 483 | k := m[1] | |
| @@ -457,9 +487,6 @@ func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]i | |||
| 457 | 487 | } | |
| 458 | 488 | continue | |
| 459 | 489 | } | |
| 460 | - | ||
| 461 | - | // For unknown backticked strings, only accept dotted paths that look | |
| 462 | - | // like config keys (filters out enum values like `most_visited`). | |
| 463 | 490 | if !strings.Contains(k, ".") { | |
| 464 | 491 | continue | |
| 465 | 492 | } | |
| @@ -584,7 +611,8 @@ func writeReport(path string, report *Report) error { | |||
| 584 | 611 | _, _ = fmt.Fprintln(w) | |
| 585 | 612 | } | |
| 586 | 613 | if idx == 0 { | |
| 587 | - | _, _ = fmt.Fprintln(w, "(none)\n") | |
| 614 | + | _, _ = fmt.Fprintln(w, "(none)") | |
| 615 | + | _, _ = fmt.Fprintln(w) | |
| 588 | 616 | } | |
| 589 | 617 | } | |
| 590 | 618 | ||
| @@ -436,6 +436,7 @@ func verifyConfigDoc(report *Report, schemaKeys map[string]struct{}, configDocPa | |||||
| 436 | 436 | ||||
| 437 | func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]int { | 437 | func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]int { | ||
| 438 | keyRe := regexp.MustCompile("`([a-zA-Z0-9_.-]+)`") | 438 | keyRe := regexp.MustCompile("`([a-zA-Z0-9_.-]+)`") | ||
| 439 | + | tableRowRe := regexp.MustCompile(`^\|`) | |||
| 439 | inCode := false | 440 | inCode := false | ||
| 440 | 441 | ||||
| 441 | seen := map[string]int{} | 442 | seen := map[string]int{} | ||
| @@ -448,6 +449,35 @@ func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]i | |||||
| 448 | if inCode { | 449 | if inCode { | ||
| 449 | continue | 450 | continue | ||
| 450 | } | 451 | } | ||
| 452 | + | ||||
| 453 | + | // Prefer extracting keys from the first column of Markdown tables. | |||
| 454 | + | // This avoids false-positives from enum values shown in other columns. | |||
| 455 | + | if tableRowRe.MatchString(trim) { | |||
| 456 | + | // Skip table separator rows. | |||
| 457 | + | if strings.Contains(trim, "---") { | |||
| 458 | + | continue | |||
| 459 | + | } | |||
| 460 | + | parts := strings.Split(line, "|") | |||
| 461 | + | if len(parts) >= 3 { | |||
| 462 | + | firstCell := strings.TrimSpace(parts[1]) | |||
| 463 | + | matches := keyRe.FindAllStringSubmatch(firstCell, -1) | |||
| 464 | + | for _, m := range matches { | |||
| 465 | + | k := m[1] | |||
| 466 | + | if k == "" || k[0] < 'a' || k[0] > 'z' { | |||
| 467 | + | continue | |||
| 468 | + | } | |||
| 469 | + | if strings.ContainsAny(k, " /") { | |||
| 470 | + | continue | |||
| 471 | + | } | |||
| 472 | + | if _, already := seen[k]; !already { | |||
| 473 | + | seen[k] = i + 1 | |||
| 474 | + | } | |||
| 475 | + | } | |||
| 476 | + | } | |||
| 477 | + | continue | |||
| 478 | + | } | |||
| 479 | + | ||||
| 480 | + | // Outside of tables, only accept dotted paths that look like config keys. | |||
| 451 | matches := keyRe.FindAllStringSubmatch(line, -1) | 481 | matches := keyRe.FindAllStringSubmatch(line, -1) | ||
| 452 | for _, m := range matches { | 482 | for _, m := range matches { | ||
| 453 | k := m[1] | 483 | k := m[1] | ||
| @@ -457,9 +487,6 @@ func extractDocKeys(lines []string, schemaKeys map[string]struct{}) map[string]i | |||||
| 457 | } | 487 | } | ||
| 458 | continue | 488 | continue | ||
| 459 | } | 489 | } | ||
| 460 | - | ||||
| 461 | - | // For unknown backticked strings, only accept dotted paths that look | |||
| 462 | - | // like config keys (filters out enum values like `most_visited`). | |||
| 463 | if !strings.Contains(k, ".") { | 490 | if !strings.Contains(k, ".") { | ||
| 464 | continue | 491 | continue | ||
| 465 | } | 492 | } | ||
| @@ -584,7 +611,8 @@ func writeReport(path string, report *Report) error { | |||||
| 584 | _, _ = fmt.Fprintln(w) | 611 | _, _ = fmt.Fprintln(w) | ||
| 585 | } | 612 | } | ||
| 586 | if idx == 0 { | 613 | if idx == 0 { | ||
| 587 | - | _, _ = fmt.Fprintln(w, "(none)\n") | 614 | + | _, _ = fmt.Fprintln(w, "(none)") |
| 615 | + | _, _ = fmt.Fprintln(w) | |||
| 588 | } | 616 | } | ||
| 589 | } | 617 | } | ||
| 590 | 618 | ||||
M docs/CONFIG.md +18 -5
| @@ -174,13 +174,23 @@ border = "#363636" | |||
| 174 | 174 | |-----|------|---------|-------------| | |
| 175 | 175 | | `debug.enable_devtools` | bool | `true` | Enable browser developer tools (F12, Inspect Element) | | |
| 176 | 176 | ||
| 177 | - | ## Rendering & Zoom | |
| 177 | + | ## Rendering, UI Scale & Zoom | |
| 178 | 178 | ||
| 179 | 179 | | Key | Type | Default | Valid Values | Description | | |
| 180 | 180 | |-----|------|---------|--------------|-------------| | |
| 181 | - | | `rendering_mode` | string | `"gpu"` | `auto`, `gpu`, `cpu` | Rendering mode | | |
| 182 | - | | `use_dom_zoom` | bool | `false` | - | Use DOM-based zoom | | |
| 183 | - | | `default_zoom` | float | `1.2` | > 0 | Default zoom level (120%) | | |
| 181 | + | | `rendering.mode` | string | `"gpu"` | `auto`, `gpu`, `cpu` | WebKit hardware acceleration policy | | |
| 182 | + | | `rendering.disable_dmabuf_renderer` | bool | `false` | - | Disable WebKit DMA-BUF renderer (may fix flicker on Wayland; slower) | | |
| 183 | + | | `rendering.force_compositing_mode` | bool | `false` | - | Force WebKit compositing mode (`WEBKIT_FORCE_COMPOSITING_MODE`) | | |
| 184 | + | | `rendering.disable_compositing_mode` | bool | `false` | - | Disable WebKit compositing mode (`WEBKIT_DISABLE_COMPOSITING_MODE`) | | |
| 185 | + | | `rendering.gsk_renderer` | string | `"vulkan"` | `auto`, `opengl`, `vulkan`, `cairo` | GTK renderer selection (`GSK_RENDERER`) | | |
| 186 | + | | `rendering.disable_mipmaps` | bool | `false` | - | Disable GTK mipmaps (`GSK_GPU_DISABLE=mipmap`) | | |
| 187 | + | | `rendering.prefer_gl` | bool | `false` | - | Prefer OpenGL over GLES (`GDK_DEBUG=gl-prefer-gl`) | | |
| 188 | + | | `rendering.draw_compositing_indicators` | bool | `false` | - | Draw WebKit compositing indicators (debug) | | |
| 189 | + | | `rendering.show_fps` | bool | `false` | - | Show WebKit FPS counter (`WEBKIT_SHOW_FPS`) | | |
| 190 | + | | `rendering.sample_memory` | bool | `false` | - | Enable WebKit memory sampling (`WEBKIT_SAMPLE_MEMORY`) | | |
| 191 | + | | `rendering.debug_frames` | bool | `false` | - | Enable GTK frame timing debug (`GDK_DEBUG=frames`) | | |
| 192 | + | | `default_ui_scale` | float | `1.0` | > 0 | GTK widget UI scale (1.0=100%, 2.0=200%) | | |
| 193 | + | | `default_webpage_zoom` | float | `1.2` | > 0 | Default page zoom (1.0=100%, 1.2=120%) | | |
| 184 | 194 | ||
| 185 | 195 | ## Workspace Configuration | |
| 186 | 196 | ||
| @@ -357,8 +367,11 @@ All config values can be overridden via environment variables with the prefix `D | |||
| 357 | 367 | # Database | |
| 358 | 368 | DUMBER_DATABASE_PATH=/custom/path/db.sqlite | |
| 359 | 369 | ||
| 360 | - | # Rendering | |
| 370 | + | # Rendering (examples) | |
| 371 | + | # Defaults: rendering.disable_dmabuf_renderer=false, rendering.gsk_renderer="vulkan" | |
| 361 | 372 | DUMBER_RENDERING_MODE=cpu | |
| 373 | + | # DUMBER_RENDERING_DISABLE_DMABUF_RENDERER=true | |
| 374 | + | # DUMBER_RENDERING_GSK_RENDERER=opengl | |
| 362 | 375 | DUMBER_DEFAULT_WEBPAGE_ZOOM=1.5 | |
| 363 | 376 | ||
| 364 | 377 | # Logging | |
| @@ -174,13 +174,23 @@ border = "#363636" | |||||
| 174 | |-----|------|---------|-------------| | 174 | |-----|------|---------|-------------| | ||
| 175 | | `debug.enable_devtools` | bool | `true` | Enable browser developer tools (F12, Inspect Element) | | 175 | | `debug.enable_devtools` | bool | `true` | Enable browser developer tools (F12, Inspect Element) | | ||
| 176 | 176 | ||||
| 177 | - | ## Rendering & Zoom | 177 | + | ## Rendering, UI Scale & Zoom |
| 178 | 178 | ||||
| 179 | | Key | Type | Default | Valid Values | Description | | 179 | | Key | Type | Default | Valid Values | Description | | ||
| 180 | |-----|------|---------|--------------|-------------| | 180 | |-----|------|---------|--------------|-------------| | ||
| 181 | - | | `rendering_mode` | string | `"gpu"` | `auto`, `gpu`, `cpu` | Rendering mode | | 181 | + | | `rendering.mode` | string | `"gpu"` | `auto`, `gpu`, `cpu` | WebKit hardware acceleration policy | |
| 182 | - | | `use_dom_zoom` | bool | `false` | - | Use DOM-based zoom | | 182 | + | | `rendering.disable_dmabuf_renderer` | bool | `false` | - | Disable WebKit DMA-BUF renderer (may fix flicker on Wayland; slower) | |
| 183 | - | | `default_zoom` | float | `1.2` | > 0 | Default zoom level (120%) | | 183 | + | | `rendering.force_compositing_mode` | bool | `false` | - | Force WebKit compositing mode (`WEBKIT_FORCE_COMPOSITING_MODE`) | |
| 184 | + | | `rendering.disable_compositing_mode` | bool | `false` | - | Disable WebKit compositing mode (`WEBKIT_DISABLE_COMPOSITING_MODE`) | | |||
| 185 | + | | `rendering.gsk_renderer` | string | `"vulkan"` | `auto`, `opengl`, `vulkan`, `cairo` | GTK renderer selection (`GSK_RENDERER`) | | |||
| 186 | + | | `rendering.disable_mipmaps` | bool | `false` | - | Disable GTK mipmaps (`GSK_GPU_DISABLE=mipmap`) | | |||
| 187 | + | | `rendering.prefer_gl` | bool | `false` | - | Prefer OpenGL over GLES (`GDK_DEBUG=gl-prefer-gl`) | | |||
| 188 | + | | `rendering.draw_compositing_indicators` | bool | `false` | - | Draw WebKit compositing indicators (debug) | | |||
| 189 | + | | `rendering.show_fps` | bool | `false` | - | Show WebKit FPS counter (`WEBKIT_SHOW_FPS`) | | |||
| 190 | + | | `rendering.sample_memory` | bool | `false` | - | Enable WebKit memory sampling (`WEBKIT_SAMPLE_MEMORY`) | | |||
| 191 | + | | `rendering.debug_frames` | bool | `false` | - | Enable GTK frame timing debug (`GDK_DEBUG=frames`) | | |||
| 192 | + | | `default_ui_scale` | float | `1.0` | > 0 | GTK widget UI scale (1.0=100%, 2.0=200%) | | |||
| 193 | + | | `default_webpage_zoom` | float | `1.2` | > 0 | Default page zoom (1.0=100%, 1.2=120%) | | |||
| 184 | 194 | ||||
| 185 | ## Workspace Configuration | 195 | ## Workspace Configuration | ||
| 186 | 196 | ||||
| @@ -357,8 +367,11 @@ All config values can be overridden via environment variables with the prefix `D | |||||
| 357 | # Database | 367 | # Database | ||
| 358 | DUMBER_DATABASE_PATH=/custom/path/db.sqlite | 368 | DUMBER_DATABASE_PATH=/custom/path/db.sqlite | ||
| 359 | 369 | ||||
| 360 | - | # Rendering | 370 | + | # Rendering (examples) |
| 371 | + | # Defaults: rendering.disable_dmabuf_renderer=false, rendering.gsk_renderer="vulkan" | |||
| 361 | DUMBER_RENDERING_MODE=cpu | 372 | DUMBER_RENDERING_MODE=cpu | ||
| 373 | + | # DUMBER_RENDERING_DISABLE_DMABUF_RENDERER=true | |||
| 374 | + | # DUMBER_RENDERING_GSK_RENDERER=opengl | |||
| 362 | DUMBER_DEFAULT_WEBPAGE_ZOOM=1.5 | 375 | DUMBER_DEFAULT_WEBPAGE_ZOOM=1.5 | ||
| 363 | 376 | ||||
| 364 | # Logging | 377 | # Logging | ||