Skip to content

Add Wiki Site web view with navigation, search, and themes - #51

Merged
AlexJSully merged 3 commits into
mainfrom
49-web-view-that-renders-the-workspace-wiki-as-a-navigable-docs-site
Nov 12, 2026
Merged

AlexJSully merged 3 commits into
mainfrom
49-web-view-that-renders-the-workspace-wiki-as-a-navigable-docs-site

Conversation

@AlexJSully

@AlexJSully AlexJSully commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Adds an "Open Wiki Site" command that shows the Workspace Wiki tree as a documentation site in an editor tab. Closes #49.

The site has a navigation tree, breadcrumbs, an "On this page" outline, and full-text search with a results page. It renders Markdown with Mermaid diagrams, sanitized HTML, highlighted source files, images, and PDFs, on desktop and in VS Code for the Web.

Middle-clicking a page opens it in a new wiki tab, and double-clicking a navigation entry opens its source file. Right-clicking a page or link shows VS Code's context menu with open, edit, and copy commands.

A left click on an external link goes through env.openExternal. A middle click opens it in a new tab of the integrated browser: the command is workbench.action.browser.open (browserView.ts: const commandPrefix = 'workbench.action.browser';), and each call creates a new editor (browserTabManagementFeatures.ts: const resource = BrowserViewUri.forId(generateUuid());).

The header shows the workspace's favicon or logo. The tab icon takes an SVG or PNG favicon only, because VS Code serves a workspace image to its own interface only with these extensions (protocolMainService.ts: new Set(['.svg', '.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.mp4', '.otf', '.ttf'])). Without one, the tab shows new light and dark variants of the extension icon.

Four themes (vscode, paper, slate, lagoon) and the workspaceWiki.site.customCss setting style the site.

PDFs render with the legacy build of pdf.js. The modern build failed in Cypress's Electron with hashOriginal.toHex is not a function.

Cypress tests drive the webview through a standalone harness page with a fake extension host.

PR also includes the following changes:

  • matchesGlobPattern expands {a,b} alternations. VS Code 1.146 declares the Markdown Editor selector as "filenamePattern": "*.{md,mkd,mkdn,mdwn,mdown,markdown,markdn,mdtxt,mdtext,litcoffee,ron,ronn,workbook}" (package.json), so .md files opened in the preview instead of the Markdown Editor.
  • tsconfig.json uses the DOM lib for the webview, and ESLint blocks DOM globals in extension-host code.
  • Dependency updates, including @vscode/vsce 4.1.0 and markdownlint-cli2 0.24.0.
brag.mp4

Open Wiki Site renders the Workspace Wiki tree as a docs site in an editor tab: navigation, breadcrumbs, an "On this page" outline, full-text search, four themes, custom CSS, and the workspace logo.

It renders Markdown with Mermaid, sanitized HTML, source files, images, and PDFs, on desktop and VS Code for the Web.

Also includes:
- Cypress tests for the webview against a standalone harness
- Brace patterns in matchesGlobPattern, so VS Code 1.146's Markdown Editor selector matches

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Outstanding defects cause incomplete search results, PDF resource leaks and screen-reader barriers, duplicate heading IDs, incorrect history restoration, and broken responsive images.

6 open issues
What changed in this PR

Adds a Wiki Site editor tab that presents Workspace Wiki’s existing document tree as a searchable documentation site on desktop and VS Code for the Web, addressing #49.

Changes:

  • Adds navigation, search, document rendering, themes, branding, and file/link actions.
  • Shares tree loading with the sidebar and supports brace-pattern matching for Markdown Editor selectors.
  • Adds unit, extension, and Cypress coverage, plus build configuration and documentation.
File Description
tsconfig.json Adds DOM types, site aliases, and Cypress exclusions.
src/​utils/​textUtils.ts Adds front matter stripping for rendered pages.
src/​utils/​textUtils.test.ts Tests front matter stripping.
src/​utils/​fileUtils.ts Adds brace expansion to glob matching.
src/​utils/​fileUtils.test.ts Tests brace expansion and matching.
src/​tree/​treeProvider.ts Uses the shared wiki tree loader.
src/​tree/​loadWikiTree.ts Centralizes scanning and configured tree construction.
src/​tree/​loadWikiTree.test.ts Tests shared tree loading and settings.
src/​tree/​index.ts Exports the shared loader.
src/​test/​web/​index.ts Adds web-host command and tab checks.
src/​test/​setupTests.ts Adds webview and host API mocks.
src/​site/​webview/​render.ts Renders, sanitizes, and prepares document HTML.
src/​site/​webview/​pdf/​viewer.ts Draws PDF pages with pdf.js.
src/​site/​webview/​pdf/​pdfWorker.d.ts Declares the PDF worker module.
src/​site/​webview/​pdf.ts Loads the PDF viewer and displays status.
src/​site/​webview/​mermaid.ts Loads and renders Mermaid diagrams.
src/​site/​webview/​main.ts Starts the webview application.
src/​site/​webview/​loadScript.ts Loads optional scripts once.
src/​site/​webview/​helpers.ts Adds routing, navigation, and rendering helpers.
src/​site/​webview/​helpers.test.ts Tests DOM-free webview logic.
src/​site/​webview/​harness/​index.html Adds the standalone test page.
src/​site/​webview/​harness/​harness.ts Simulates the extension host for Cypress.
src/​site/​webview/​harness/​harness.css Supplies VS Code theme variables for tests.
src/​site/​webview/​harness/​fixtures/​assets/​src/​diagram.svg Adds an image-page fixture.
src/​site/​webview/​harness/​fixtures/​assets/​logo.svg Adds a branding fixture.
src/​site/​webview/​harness/​fixtures/​assets/​docs/​images/​diagram.svg Adds a relative-image fixture.
src/​site/​webview/​harness/​fixtures/​assets/​custom.css Adds a custom-theme fixture.
src/​site/​webview/​harness/​fixtures.ts Defines sample trees and document content.
src/​site/​webview/​bridge.ts Abstracts host messaging and saved state.
src/​site/​searchDocs.ts Implements search ranking and highlighted snippets.
src/​site/​searchDocs.test.ts Tests ranking, snippets, and text extraction.
src/​site/​search.ts Adds lazy document indexing and updates.
src/​site/​search.test.ts Tests index loading and invalidation.
src/​site/​protocol.ts Defines shared messages and page data.
src/​site/​pageContent.ts Classifies files and prepares document content.
src/​site/​pageContent.test.ts Tests classification, decoding, and truncation.
src/​site/​links.ts Resolves document and workspace links.
src/​site/​links.test.ts Tests link resolution, including virtual workspaces.
src/​site/​index.ts Exports the site’s host-facing API.
src/​site/​branding.ts Discovers and ranks logos and tab icons.
src/​site/​branding.test.ts Tests branding selection and fallbacks.
src/​extension.ts Registers site commands and refresh/save listeners.
src/​extension.test.ts Tests site command and listener wiring.
src/​extension.e2e.test.ts Tests site tabs and commands in VS Code.
src/​controllers/​previewController.test.ts Covers Markdown Editor brace selectors.
scripts/​runWithoutElectronNode.mjs Removes the Electron Node-mode environment flag.
README.md Documents Wiki Site features and settings.
package.json Adds commands, settings, dependencies, and test scripts.
media/​icon-light.svg Adds the light-theme fallback tab icon.
media/​icon-dark.svg Adds the dark-theme fallback tab icon.
jest.config.js Adds site module aliases.
eslint.config.mjs Restricts DOM globals outside webview code.
esbuild.js Builds webview bundles and the Cypress harness.
docs/​usage/​workflows.md Documents Cypress CI execution.
docs/​usage/​tutorials.md Adds site navigation and styling tutorials.
docs/​usage/​testing.md Documents the harness and Cypress workflow.
docs/​architecture/​wiki-site.md Describes site architecture and behavior.
docs/​architecture/​utilities.md Documents brace-pattern matching.
docs/​architecture/​tree-data-provider.md Documents shared tree loading.
docs/​architecture/​settings.md Adds site settings and configuration flow.
docs/​architecture/​preview-controller.md Updates Markdown Editor selector documentation.
docs/​architecture/​index.md Incorporates the webview into the architecture.
cypress/​tsconfig.json Separates Cypress test types.
cypress/​support/​e2e.ts Loads shared Cypress commands.
cypress/​support/​commands.ts Adds harness messaging and accessibility helpers.
cypress/​e2e/​search.cy.ts Tests search interactions and results.
cypress/​e2e/​rendering.cy.ts Tests rendering, sanitization, and live updates.
cypress/​e2e/​navigation.cy.ts Tests navigation, history, and responsive layouts.
cypress/​e2e/​links.cy.ts Tests link actions and context-menu data.
cypress/​e2e/​branding-themes.cy.ts Tests branding and theme customization.
cypress/​e2e/​accessibility.cy.ts Adds automated accessibility checks.
cypress.config.ts Configures browser-based harness tests.
.vscodeignore Excludes test and script sources from packaging.
.prettierignore Excludes generated Cypress artifacts.
.gitignore Ignores Cypress downloads.
.github/​workflows/​code-qa-js.yaml Runs Cypress and uploads failure screenshots.
.github/​copilot-instructions.md Documents webview testing and DOM boundaries.

Review effort: Balanced

Comment thread src/site/search.ts Resolved
Comment thread src/site/webview/helpers.ts Resolved
Comment thread src/site/webview/helpers.ts Resolved
Comment thread src/site/webview/pdf/viewer.ts Resolved
Comment thread src/site/webview/pdf/viewer.ts Resolved
Comment thread src/site/webview/render.ts Resolved
AlexJSully and others added 2 commits November 11, 2026 19:44
… rendering

The host checks every URI the webview names: pages must be in the wiki tree, and
other files must sit inside a workspace folder. Documents can no longer set
data-* attributes, heading ids no longer collide with the shell, and malformed
percent-encoding no longer throws.

PDF rendering and pdfjs-dist are removed, so the webview policy drops blob: and
connect-src and the bundles carry no WebAssembly. PDFs show the open-file card.

Also includes:
- A stale tree load or a save during the first search build no longer loses data
- Hidden tabs keep "Open in Wiki Site" routes; re-renders keep the scroll position
- Logo search runs exact and suffixed names separately
- Mermaid stops drawing on replaced pages; the index is freed with the last tab
- app.ts and sitePanel.ts split by responsibility; context commands in commands.ts
- dist/THIRD_PARTY_NOTICES.txt lists the licence of each bundled package
- Tests and docs updated to match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AlexJSully AlexJSully changed the title Add Wiki Site web view with search, themes, and PDF support Add Wiki Site web view with navigation, search, and themes Nov 12, 2026
@AlexJSully
AlexJSully merged commit f354433 into main Nov 12, 2026
2 checks passed
@AlexJSully
AlexJSully deleted the 49-web-view-that-renders-the-workspace-wiki-as-a-navigable-docs-site branch November 12, 2026 03:20
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.

Web view that renders the workspace wiki as a navigable docs site

2 participants