Skip to content

feat(web): more customizable templates#747

Open
avivkeller wants to merge 10 commits intomainfrom
more-custom-web
Open

feat(web): more customizable templates#747
avivkeller wants to merge 10 commits intomainfrom
more-custom-web

Conversation

@avivkeller
Copy link
Copy Markdown
Member

@avivkeller avivkeller commented Apr 2, 2026

This PR makes the web generator even more customizable, for the learn content.

It:

  1. Allows doc-kit configs to supply custom virtual modules, which will allow the learn contents' config to supply a reference to navigation.json to populate the navigation the same as we do in core.
  2. Allows doc-kit templates to see more of the config object, + path, meaning they can set their own canonical URLs using path, and whatnot.
  3. Allows any custom configs (that are primitives) to be passed to any custom components, which makes it easy to extend the web generator.

Copilot AI review requested due to automatic review settings April 2, 2026 21:21
@avivkeller avivkeller requested a review from a team as a code owner April 2, 2026 21:21
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Apr 3, 2026 6:01pm

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 48.27586% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.08%. Comparing base (63c24b9) to head (620eaed).

Files with missing lines Patch % Lines
src/generators/web/utils/config.mjs 15.38% 22 Missing ⚠️
src/generators/web/utils/processing.mjs 0.00% 16 Missing ⚠️
src/generators/jsx-ast/utils/buildContent.mjs 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #747      +/-   ##
==========================================
- Coverage   77.17%   77.08%   -0.09%     
==========================================
  Files         153      153              
  Lines       13771    13749      -22     
  Branches     1114     1111       -3     
==========================================
- Hits        10628    10599      -29     
- Misses       3139     3146       +7     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

web Generator

File Base Head Diff
addons.html 262.55 KB 262.56 KB +13.00 B (+0.00%)
assert.html 329.99 KB 330.00 KB +12.00 B (+0.00%)
async_context.html 187.56 KB 187.58 KB +12.00 B (+0.01%)
async_hooks.html 159.70 KB 159.71 KB +12.00 B (+0.01%)
buffer.html 905.71 KB 905.72 KB +12.00 B (+0.00%)
child_process.html 381.69 KB 381.70 KB +12.00 B (+0.00%)
cli.html 495.10 KB 495.11 KB +12.00 B (+0.00%)
cluster.html 196.29 KB 196.30 KB +12.00 B (+0.01%)
console.html 146.76 KB 146.77 KB +12.00 B (+0.01%)
crypto.html 1.09 MB 1.09 MB +12.00 B (+0.00%)
debugger.html 54.21 KB 54.22 KB +12.00 B (+0.02%)
deprecations.html 505.30 KB 505.31 KB +12.00 B (+0.00%)
dgram.html 194.36 KB 194.37 KB +12.00 B (+0.01%)
diagnostics_channel.html 303.41 KB 303.42 KB +12.00 B (+0.00%)
dns.html 295.80 KB 295.81 KB +12.00 B (+0.00%)
documentation.html 38.03 KB 38.04 KB +12.00 B (+0.03%)
domain.html 105.09 KB 105.10 KB +12.00 B (+0.01%)
embedding.html 59.42 KB 59.43 KB +12.00 B (+0.02%)
environment_variables.html 44.03 KB 44.04 KB +12.00 B (+0.03%)
errors.html 461.17 KB 461.18 KB +12.00 B (+0.00%)
esm.html 155.32 KB 155.33 KB +12.00 B (+0.01%)
events.html 455.26 KB 455.27 KB +12.00 B (+0.00%)
fs.html 1.43 MB 1.43 MB +12.00 B (+0.00%)
globals.html 230.36 KB 230.37 KB +12.00 B (+0.01%)
http.html 738.70 KB 738.71 KB +12.00 B (+0.00%)
http2.html 768.58 KB 768.59 KB +12.00 B (+0.00%)
https.html 150.34 KB 150.35 KB +12.00 B (+0.01%)
index.html 36.23 KB 36.25 KB +12.00 B (+0.03%)
inspector.html 171.37 KB 171.38 KB +12.00 B (+0.01%)
intl.html 58.13 KB 58.14 KB +12.00 B (+0.02%)
module.html 326.65 KB 326.66 KB +12.00 B (+0.00%)
modules.html 178.72 KB 178.73 KB +12.00 B (+0.01%)
n-api.html 807.24 KB 807.25 KB +12.00 B (+0.00%)
net.html 382.28 KB 382.29 KB +12.00 B (+0.00%)
os.html 142.72 KB 142.73 KB +12.00 B (+0.01%)
packages.html 154.64 KB 154.65 KB +12.00 B (+0.01%)
path.html 139.25 KB 139.26 KB +12.00 B (+0.01%)
perf_hooks.html 381.48 KB 381.49 KB +12.00 B (+0.00%)
permissions.html 55.13 KB 55.14 KB +12.00 B (+0.02%)
process.html 676.14 KB 676.15 KB +12.00 B (+0.00%)
punycode.html 63.18 KB 63.19 KB +12.00 B (+0.02%)
querystring.html 63.84 KB 63.85 KB +12.00 B (+0.02%)
quic.html 358.96 KB 358.98 KB +12.00 B (+0.00%)
readline.html 252.16 KB 252.17 KB +12.00 B (+0.00%)
repl.html 183.29 KB 183.30 KB +12.00 B (+0.01%)
report.html 175.91 KB 175.92 KB +12.00 B (+0.01%)
single-executable-applications.html 106.93 KB 106.95 KB +12.00 B (+0.01%)
sqlite.html 268.07 KB 268.08 KB +12.00 B (+0.00%)
stream.html 855.29 KB 855.31 KB +12.00 B (+0.00%)
stream_iter.html 309.02 KB 309.03 KB +12.00 B (+0.00%)
string_decoder.html 55.38 KB 55.39 KB +12.00 B (+0.02%)
synopsis.html 42.66 KB 42.67 KB +12.00 B (+0.03%)
test.html 766.71 KB 766.72 KB +12.00 B (+0.00%)
timers.html 133.49 KB 133.51 KB +12.00 B (+0.01%)
tls.html 373.78 KB 373.79 KB +12.00 B (+0.00%)
tracing.html 84.15 KB 84.16 KB +12.00 B (+0.01%)
tty.html 95.28 KB 95.29 KB +12.00 B (+0.01%)
typescript.html 53.46 KB 53.47 KB +12.00 B (+0.02%)
url.html 347.67 KB 347.68 KB +12.00 B (+0.00%)
util.html 691.88 KB 691.89 KB +12.00 B (+0.00%)
v8.html 321.08 KB 321.09 KB +12.00 B (+0.00%)
vm.html 370.79 KB 370.80 KB +12.00 B (+0.00%)
wasi.html 69.36 KB 69.37 KB +12.00 B (+0.02%)
webcrypto.html 521.99 KB 522.00 KB +12.00 B (+0.00%)
webstreams.html 355.72 KB 355.74 KB +12.00 B (+0.00%)
worker_threads.html 365.46 KB 365.47 KB +12.00 B (+0.00%)
zlib.html 290.23 KB 290.24 KB +12.00 B (+0.00%)
zlib_iter.html 88.05 KB 88.06 KB +12.00 B (+0.01%)

This comment was marked as outdated.

avivkeller and others added 5 commits April 3, 2026 09:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 3, 2026

PR Summary

Medium Risk
Medium risk because it changes how HTML templates are populated and how #theme/config exports are generated, which can alter rendered output and bundling behavior across all web builds.

Overview
Makes the web generator more configurable by adding project, templated title, and support for user-supplied virtualImports merged into the bundler.

Switches HTML rendering from ad-hoc {{...}} string replacements to populate() with {var} placeholders, and expands #theme/config generation to export most scalar config values (while omitting large keys) plus updated languageDisplayNameMap entries.

Replaces extractPrimitives with a new omitKeys helper and updates metadata serialization/tests accordingly; also adjusts UI bits (sidebar label uses project, navbar GitHub aria-label, search results use relative links) and bumps package version to 1.3.2.

Written by Cursor Bugbot for commit 620eaed. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Premature {version} replacement breaks version selector URLs
    • createConfigSource now excludes version before populating pageURL, preserving {version} for per-entry replacement in buildVersionEntries.

Create PR

Or push these changes by commenting:

@cursor push 4e86c88af1
Preview (4e86c88af1)
diff --git a/src/generators/web/utils/config.mjs b/src/generators/web/utils/config.mjs
--- a/src/generators/web/utils/config.mjs
+++ b/src/generators/web/utils/config.mjs
@@ -76,7 +76,9 @@
 
   const version = `v${config.version.version}`;
   const editURL = populate(config.editURL, { ...config, version });
-  const pageURL = populate(config.pageURL, config);
+  const configWithoutVersion = { ...config };
+  delete configWithoutVersion.version;
+  const pageURL = populate(config.pageURL, configWithoutVersion);
 
   const exports = {
     ...Object.fromEntries(

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

…late()\n\nAvoid passing config.version (SemVer) to populate(config.pageURL, ...) so the {version} placeholder remains for buildVersionEntries to substitute per-version labels. This restores correct version selector URLs.

Co-authored-by: Claudio Wunder <cwunder@gnome.org>
@avivkeller avivkeller requested a review from ovflowd April 3, 2026 14:32
@avivkeller avivkeller mentioned this pull request Apr 3, 2026
4 tasks
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

...omitKeys(
config,
// These are keys that are large, and not needed by components, so we ignore them
['changelog', 'index', 'imports', 'virtualImport']
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in omit key: virtualImport vs virtualImports

Medium Severity

The omit list uses 'virtualImport' (singular), but the actual configuration key defined in defaultConfiguration and types.d.ts is 'virtualImports' (plural). This means the virtualImports object won't be excluded and will be serialized into the #theme/config virtual module as an unnecessary named export, increasing the client bundle size and exposing an internal config value that was intended to be filtered out.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants