-
Notifications
You must be signed in to change notification settings - Fork 40
DOC-18329: typedoc indexing improvements #6817
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a4baca4
docs(typedoc): title tweaks for indexing
jpmarceau 29795fc
docs(headless): indexing title improvement
jpmarceau d8b4785
docs(headless): indexing title improvement
jpmarceau 072be6f
docs(headless): indexing improvement
jpmarceau f78862b
docs(headless): indexing improvement
jpmarceau 061ccbf
docs(headless): indexing improvement
jpmarceau 4eaad20
docs(headless): indexing improvement
jpmarceau 99bf762
Apply suggestions from code review
jpmarceau f36b0a1
Improve regex pattern to handle consecutive uppercase letters and num…
Copilot 179bfef
Refactor insertMetaTags to consolidate variable declarations (#6825)
Copilot 39a9add
Merge branch 'main' into DOC-18329
jpmarceau 60a70d8
Merge branch 'main' into DOC-18329
jpmarceau 49cc4a2
Merge branch 'main' into DOC-18329
jpmarceau 01f6fdc
Merge branch 'main' into DOC-18329
jpmarceau 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 |
|---|---|---|
| @@ -1,11 +1,34 @@ | ||
| export const insertMetaTags = () => { | ||
| const head = document.getElementsByTagName('head')[0]; | ||
| if (head) { | ||
| head.innerHTML += ` | ||
| <meta name="color-scheme" content="light dark"> | ||
| <meta name="theme-color" content="light"> | ||
| <meta name="docsSiteUrl" content="https://docs.coveo.com"> | ||
| <meta name="docsSiteBaseUrl" content="/en"> | ||
| `; | ||
| import {DocumentReflection, type PageEvent} from 'typedoc'; | ||
|
|
||
| export const insertMetaTags = (page: PageEvent) => { | ||
| if (!page.contents) return; | ||
|
|
||
| const metaTags = [ | ||
| '<meta name="color-scheme" content="light dark">', | ||
| '<meta name="theme-color" content="light">', | ||
| '<meta name="docsSiteUrl" content="https://docs.coveo.com">', | ||
| '<meta name="docsSiteBaseUrl" content="/en">', | ||
| ]; | ||
|
|
||
| const isHandwrittenDoc = page.model instanceof DocumentReflection; | ||
jpmarceau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (!isHandwrittenDoc) { | ||
| const titleMatch = page.contents.match(/<title>\s*([^<]*)<\/title>/i); | ||
| if (titleMatch) { | ||
| const originalTitle = titleMatch[1]; | ||
| const formattedName = originalTitle | ||
| .split(' | ')[0] | ||
| .replace(/([a-z0-9])([A-Z])/g, '$1 $2') | ||
| .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2') | ||
| .toLowerCase(); | ||
| metaTags.push( | ||
| `<meta name="docsSiteMeta" content="${formattedName} reference" />` | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| page.contents = page.contents.replace( | ||
| /<\/head>/, | ||
| `${metaTags.join('\n')}\n</head>` | ||
| ); | ||
jpmarceau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| { | ||
| "name": "Coveo Headless", | ||
| "highlightLanguages": [ | ||
| "typescript", | ||
| "javascript", | ||
|
|
||
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.