Skip to content

feat(docs): add in-app documentation system#166

Open
emlimlf wants to merge 10 commits into
mainfrom
feat/in-app-documentation
Open

feat(docs): add in-app documentation system#166
emlimlf wants to merge 10 commits into
mainfrom
feat/in-app-documentation

Conversation

@emlimlf

@emlimlf emlimlf commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements the full /docs section per LFXV2-2197
  • Markdown content for all required topics: initiatives (+ 3 sub-pages), donations (+ 2 sub-pages), payment-account, backers, reimbursements, and getting-started
  • Runtime Nuxt server API routes serving sections list and rendered article HTML (js-yaml frontmatter, marked renderer, DOMPurify sanitization)
  • Build pipeline (scripts/build-docs.mjs) producing a MiniSearch-compatible search index; auto-runs before pnpm dev and pnpm build
  • Full-text search component with lazy index loading, debounced input, and fuzzy + prefix matching
  • Nested sidebar navigation with active parent expansion and exact-match child highlighting
  • Multi-level breadcrumbs for sub-section articles
  • Light SEO pass on /docs pages: useSeoMeta with OG/Twitter cards and canonical URLs

Changes

  • docs/user/ — 11 Markdown articles across 7 top-level sections with YAML frontmatter
  • frontend/server/api/docs/index.get.ts (sections + children) and [...slug].get.ts (article renderer with relative link rewriting)
  • frontend/shared/types/documentation.types.tsDocSection, DocArticle, DocSearchDocument, DocSearchResult types
  • frontend/app/pages/docs/ — landing and catch-all article pages
  • frontend/app/components/modules/documentation/docs-landing, docs-article, docs-sidebar, docs-search components
  • frontend/app/composables/documentation/useDocumentation, useDocumentationNav composables
  • frontend/scripts/build-docs.mjs — docs build pipeline
  • frontend/public/images/docs/ — 6 screenshot images
  • package.json — added docs:build script, wired into dev and build; added minisearch dependency

Test plan

  • /docs landing page renders topic card grid with search bar
  • Search returns relevant results (try "donation", "initiative", "expense")
  • Clicking a search result navigates to the correct article and clears input
  • /docs/initiatives shows nested sidebar with sub-pages (Browsing, Create, Manage)
  • /docs/initiatives/browsing-initiatives shows breadcrumb: Docs > Initiatives > Browsing Initiatives
  • /docs/donations/make-donation renders images and LF ID callout
  • Last updated date renders as YYYY-MM-DD (not ISO timestamp)
  • pnpm docs:build runs standalone without errors
  • All docs pages publicly accessible (no auth required)

🤖 Generated with Claude Code

Signed-off-by: Efren Lim <elim@linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 16, 2026 10:16

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.

Pull request overview

Adds an in-app documentation system under /docs, backed by Markdown files in docs/user/, server-side rendering endpoints, and a client-side search experience.

Changes:

  • Introduces new docs data types plus Nitro API routes to list sections and render Markdown articles as sanitized HTML.
  • Adds a docs build pipeline that generates a MiniSearch-compatible search index and wires it into the frontend build/dev flow.
  • Implements /docs pages and UI components (landing, article view, sidebar navigation, search) plus supporting styles and navigation links.

Reviewed changes

Copilot reviewed 29 out of 36 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
frontend/shared/types/documentation.types.ts Adds shared types for docs sections, articles, and search data/results.
frontend/server/api/docs/index.get.ts Adds docs navigation endpoint (sections + children) derived from Markdown frontmatter.
frontend/server/api/docs/[...slug].get.ts Adds article-rendering endpoint (Markdown → HTML with sanitization and link rewriting).
frontend/scripts/build-docs.mjs Adds docs index generator writing search-index JSON into public/.
frontend/pnpm-lock.yaml Locks new deps for Markdown parsing, sanitization support types, and search.
frontend/package.json Adds docs build script and wires docs index generation into build/dev.
frontend/app/pages/docs/index.vue Adds /docs landing page with SEO metadata.
frontend/app/pages/docs/[...slug].vue Adds catch-all docs article page that delegates rendering to module component.
frontend/app/config/routes.ts Adds AppRoute.Docs.
frontend/app/config/menu/header.ts Adds “Documentation” link to the header menu.
frontend/app/composables/documentation/useDocumentationNav.ts Adds composable for fetching/caching docs nav structure.
frontend/app/composables/documentation/useDocumentation.ts Adds composable for fetching/caching an individual doc article.
frontend/app/components/modules/documentation/view/docs-landing.vue Implements landing UI with section cards and search.
frontend/app/components/modules/documentation/view/docs-article.vue Implements article UI with sidebar, breadcrumbs, and SEO metadata.
frontend/app/components/modules/documentation/components/docs-sidebar.vue Implements nested sidebar navigation with active state handling.
frontend/app/components/modules/documentation/components/docs-search.vue Implements lazy-loaded MiniSearch index search UI.
frontend/app/assets/styles/utils/index.scss Registers new docs-specific utility stylesheet.
frontend/app/assets/styles/utils/_docs.scss Adds markdown/table/callout styling for docs article body.
frontend/.gitignore Ignores generated docs search index file.
docs/user/reimbursements/index.md Adds reimbursements documentation page content.
docs/user/payment-account/index.md Adds payment account documentation page content.
docs/user/initiatives/manage-initiative/index.md Adds initiative management documentation page content.
docs/user/initiatives/index.md Adds initiatives overview documentation page content.
docs/user/initiatives/create-initiative/index.md Adds initiative creation documentation page content.
docs/user/initiatives/browsing-initiatives/index.md Adds browsing initiatives documentation page content.
docs/user/getting-started/index.md Adds getting-started documentation page content.
docs/user/donations/manage-donations/index.md Adds donations management documentation page content.
docs/user/donations/make-donation/index.md Adds donation walkthrough documentation page content.
docs/user/donations/index.md Adds donations overview documentation page content.
docs/user/backers/index.md Adds backers documentation page content.
Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Comment thread frontend/server/api/docs/index.get.ts Outdated
Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Comment thread frontend/package.json
Comment thread frontend/app/pages/docs/index.vue Outdated
Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Signed-off-by: Efren Lim <elim@linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 16, 2026 10:45

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.

Pull request overview

Copilot reviewed 32 out of 39 changed files in this pull request and generated 8 comments.

Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Generated file

Comment thread frontend/server/api/docs/[...slug].get.ts Outdated
Comment thread frontend/server/utils/doc-utils.test.ts
Comment thread frontend/app/composables/documentation/useDocumentation.ts
Comment thread frontend/app/pages/docs/[...slug].vue Outdated
Comment thread frontend/app/components/modules/documentation/view/docs-article.vue Outdated
Comment thread frontend/server/utils/doc-utils.ts Outdated
Comment thread .mlc_config.json
Copilot AI review requested due to automatic review settings June 16, 2026 11:27

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.

Pull request overview

Copilot reviewed 32 out of 39 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Generated file

Comment thread frontend/server/utils/doc-utils.ts Outdated
Comment thread frontend/server/api/docs/[...slug].get.ts
Comment thread frontend/pnpm-lock.yaml
…ack on PR #166

Address review comments from copilot-pull-request-reviewer:

- frontend/server/utils/doc-utils.ts: swap getDocsDir() preference order to
  check docs/user (fromRoot) before ../docs/user (fromFrontend); the previous
  order would choose an out-of-repo path when a ../docs/user happened to exist
  on the host while running from the repo root
  (per copilot-pull-request-reviewer)

- frontend/server/utils/doc-utils.ts: add escapeAttr() helper that escapes &,
  ", ', <, > for safe HTML attribute interpolation
  (per copilot-pull-request-reviewer)

- frontend/server/api/docs/[...slug].get.ts: apply escapeAttr() to href and
  title values in buildRenderer() before interpolating into the anchor HTML
  string, providing defense-in-depth ahead of DOMPurify sanitization
  (per copilot-pull-request-reviewer)

Resolves 2 review threads. Thread on pnpm-lock.yaml is a false positive
(explained in thread reply — the >=4.2.0 specifier comes from the intentional
js-yaml override in pnpm-workspace.yaml, not a sync issue).

Signed-off-by: Efren Lim <elim@linuxfoundation.org>
@emlimlf

emlimlf commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Review Feedback Addressed

Commit: 1737979

Changes Made

  • frontend/server/utils/doc-utils.ts: swapped getDocsDir() preference order — check docs/user (fromRoot) first, fall back to ../docs/user (fromFrontend) only when running from frontend/. The previous order would incorrectly choose an out-of-repo path if one happened to exist on the host when starting from the repo root. (per copilot-pull-request-reviewer)
  • frontend/server/utils/doc-utils.ts: added escapeAttr() helper that escapes &, ", ', <, > for safe HTML attribute interpolation. (per copilot-pull-request-reviewer)
  • frontend/server/api/docs/[...slug].get.ts: applied escapeAttr() to href and title values in buildRenderer() before interpolating into the anchor HTML string — defense-in-depth ahead of DOMPurify. (per copilot-pull-request-reviewer)

No Change Needed

  • frontend/pnpm-lock.yaml:67: the >=4.2.0 specifier for js-yaml is correct — it reflects the intentional security override in frontend/pnpm-workspace.yaml (js-yaml: ">=4.2.0"). In pnpm v11 the lockfile importer specifier records the override constraint, not the package.json specifier. pnpm install --lockfile-only confirms the lockfile is already up to date. (flagged by copilot-pull-request-reviewer)

Threads Resolved

3 of 3 unresolved threads addressed in this iteration.

Copilot AI review requested due to automatic review settings June 16, 2026 12:37

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.

Pull request overview

Copilot reviewed 32 out of 39 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Generated file

Comment thread frontend/server/utils/doc-utils.ts
nunoeufrasio added a commit that referenced this pull request Jun 16, 2026
Address review comments from @mlehotskylf:

- config/menu/footer.ts: point Documentation to the in-app /docs route
  instead of the deprecated docs.linuxfoundation.org CF docs
- config/menu/header.ts: point More-menu Documentation to /docs and drop
  the now-unused external flag
- layout/components/desktop-nav.vue, mobile-menu.vue: revert external
  new-tab handling (no longer needed for an in-app link)

The in-app docs system is introduced in #166 (AppRoute.Docs = '/docs').

Resolves 2 review threads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Nuno Eufrasio <nmeufrasio@gmail.com>
Copilot AI review requested due to automatic review settings June 17, 2026 02:16

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.

Pull request overview

Copilot reviewed 32 out of 39 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Generated file

Comment on lines +12 to +17
import { readdirSync, readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
import { resolve, join } from 'node:path';
import { load as parseYaml } from 'js-yaml';

const DOCS_DIR = resolve(import.meta.dirname, '../../docs/user');
const OUT_FILE = resolve(import.meta.dirname, '../public/assets/docs/search-index.json');
…back on PR #166

Signed-off-by: Efren Lim <elim@linuxfoundation.org>
@emlimlf

emlimlf commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Review Feedback Addressed

Commit: b574673

Changes Made

  • .github/workflows/ci-release.yml + frontend/Dockerfile: Fixed production docs 404 — widened Docker build context from frontend/ to repo root so docs/user/ is included in the build. Builder stage gains COPY docs/user/ /docs/user/ (so build-docs.mjs generates a correct search index), runtime stage gains the same copy (so getDocsDir() resolves at /docs/user via ../docs/user from process.cwd()=/app). (per copilot-pull-request-reviewer[bot])
  • docs-search.vue: Fixed ensureIndex() race condition — added indexLoadPromise guard so concurrent calls (rapid typing) await the same in-flight promise instead of each triggering a duplicate $fetch + MiniSearch.addAll(). (per copilot-pull-request-reviewer[bot])

No Change Needed

  • docs-search.vue:57-58: The split </span\n> tag is intentional Prettier output with htmlWhitespaceSensitivity: 'css'. Splitting inside the closing tag keeps > and " on the same line, preventing a whitespace text node that would render as query " (space before the closing quote). pnpm format reproduces this formatting. (flagged by copilot-pull-request-reviewer[bot])

Threads Resolved

3 of 3 unresolved threads addressed in this iteration.

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.

2 participants