-
Notifications
You must be signed in to change notification settings - Fork 39
feat: migrating content from docs.coveo.com to typedoc #6624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tbaxter-coveo
wants to merge
6
commits into
main
Choose a base branch
from
DOC-17899
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,797
−114
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
939d603
feat: migrating content from docs.coveo.com to typedoc
tbaxter-coveo d528ca3
Update packages/documentation/README.md
tbaxter-coveo ced994e
chore: harmonizing headless-react and headless typedoc configs
tbaxter-coveo cdab645
chore: maintaing prefix for other unchanged urls
tbaxter-coveo 4885c6d
chore: tweak
tbaxter-coveo 068b782
chore: mainting original URLs for non projectDocuments
tbaxter-coveo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # @coveo/documentation | ||
|
|
||
| This is a typedoc plugin. It ensure that the documentation generated adheres to our styling guidelines. | ||
|
|
||
| It is used by | ||
| - `@coveo/headless` | ||
|
|
||
| ## Navigation | ||
| This plugin also deviates from the standard typedoc navigation patterns. It allows for top level documents that are ungrouped and it removes the standard | ||
| `Documents` tab for ungrouped documents. It also allows for groups to have a mixed of documents and folders based on Category, as opposed to forcing | ||
| each document in a group that has categories to _be_ categorized or otherwise lumped together into an `Others` folder. | ||
|
|
||
| The sorting of the navigation be specified, both for the top level and optionally by for groups. | ||
|
|
||
| NOTE: when specifying the sorting for groups, the key must be in lowercase not the actual casing of the document title. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import {normalize} from './normalize.js'; | ||
| import type {TNavNode} from './types.js'; | ||
|
|
||
| /** | ||
| * Hoists any child whose title equals `fallbackCategory` so its children are promoted | ||
| * to the *parent* level, at the exact position where the bucket appeared. | ||
| * Runs depth-first so descendants are processed as well. | ||
| */ | ||
| export const hoistOtherCategoryInNav = ( | ||
| root: TNavNode, | ||
| fallbackCategory: string | ||
| ) => { | ||
| if (!root) return; | ||
|
|
||
| const stack: TNavNode[] = [root]; | ||
| while (stack.length) { | ||
| const node = stack.pop()!; | ||
| const kids = node.children; | ||
| if (!Array.isArray(kids) || kids.length === 0) continue; | ||
|
|
||
| const nextChildren: TNavNode[] = []; | ||
| for (const child of kids) { | ||
| const title = typeof child.text === 'string' ? child.text : undefined; | ||
| if (title && normalize(title) === normalize(fallbackCategory)) { | ||
| if (Array.isArray(child.children) && child.children.length) { | ||
| // Promote grandchildren to the parent's level at this position | ||
| nextChildren.push(...child.children); | ||
| } | ||
| // Drop the bucket itself | ||
| } else { | ||
| nextChildren.push(child); | ||
| } | ||
| } | ||
| node.children = nextChildren; | ||
|
|
||
| // Recurse | ||
| for (const c of node.children) stack.push(c); | ||
| } | ||
| }; | ||
|
|
||
| /** | ||
| * Top-level helper for themes that return navigation as an array of nodes. | ||
| * If an element named like the fallback group exists at the root, its children are | ||
| * spliced into the root array at the same index (i.e., promoted to the top level), | ||
| * and the bucket is removed. Also applies recursive hoisting within all nodes. | ||
| */ | ||
| export const hoistOtherCategoryInArray = ( | ||
| rootItems: TNavNode[], | ||
| fallbackCategory: string, | ||
| topLevelGroup: string | ||
| ) => { | ||
| if (!Array.isArray(rootItems) || rootItems.length === 0) return; | ||
|
|
||
| // First pass: recursively hoist 'Other' within each item | ||
| for (const item of rootItems) { | ||
| hoistOtherCategoryInNav(item, fallbackCategory); | ||
| } | ||
|
|
||
| // Second pass: hoist any top-level bucket matching either fallbackCategory ('Other') | ||
| // or the requested top-level group (e.g., 'Documents'). | ||
| let i = 0; | ||
| while (i < rootItems.length) { | ||
| const item = rootItems[i]; | ||
| const title = typeof item.text === 'string' ? item.text : undefined; | ||
| if ( | ||
| title && | ||
| (normalize(title) === normalize(fallbackCategory) || | ||
| normalize(title) === normalize(topLevelGroup)) | ||
| ) { | ||
| const replacement = Array.isArray(item.children) ? item.children : []; | ||
| // Replace the bucket node with its children (promote to top level) | ||
| rootItems.splice(i, 1, ...replacement); | ||
| // Continue at same index to handle multiple merges | ||
| continue; | ||
| } | ||
| i++; | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.