Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ jobs:
# Enable debug logging when "Re-run jobs with debug logging" is used in GitHub Actions UI
# This will output additional timing and path information to help diagnose timeout issues
RUNNER_DEBUG: ${{ runner.debug }}
run: npm test -- src/${{ matrix.name }}/tests/
VITEST_FLAGS: ${{ matrix.name == 'article-api' && '--no-file-parallelism --maxWorkers=1' || '' }}
run: npm test -- $VITEST_FLAGS src/${{ matrix.name }}/tests/
2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-boxwood/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-cedar/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-cypress/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-fir/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-hemlock/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-holly/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-juniper/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-laurel/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-pine/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-redwood/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-sequoia/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/docs-internal-staging-spruce/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/review-os/secrets.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config/moda/secrets/review/secrets.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ The list of valid values for `source` are:
* Wiki_content
* Wiki_commit
* Npm
* Manual_submission
* Unknown

### Implement signature verification in your secret alert service
Expand Down
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/app/lib/main-context-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function adaptAppRouterContextToMainContext(
oldestSupported: '',
nextDeprecationDate: '',
supported: [],
releasesWithOldestDeprecationDate: [],
},
enterpriseServerVersions: [],
error: '',
Expand Down
17 changes: 3 additions & 14 deletions src/article-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ The `/api/article` endpoints return information about a page by `pathname`.

### Autogenerated Content Transformers

For autogenerated pages (REST, GraphQL, webhooks, landing pages, audit logs, etc), the Article API uses specialized transformers to convert the rendered content into markdown format. These transformers are located in `src/article-api/transformers/` and use an extensible architecture:
For autogenerated pages (REST, GraphQL, webhooks, landing pages, audit logs, etc), the Article API uses specialized transformers to convert the rendered content into markdown format. These transformers are located in `src/article-api/transformers/` and use an extensible architecture.

#### Current Transformers

- **REST Transformer** (`rest-transformer.ts`) - Converts REST API operations into markdown, including endpoints, parameters, status codes, and code examples
- **GraphQL Transformer** (`graphql-transformer.ts`) - Converts GraphQL schema documentation into markdown, including queries, mutations, objects, interfaces, enums, unions, input objects, scalars, changelog, and breaking changes
#### Transformers

To add a new transformer for other autogenerated content types:
1. Create a new transformer file implementing the `PageTransformer` interface
Expand Down Expand Up @@ -195,15 +192,7 @@ npm run test -- src/article-api/tests

- Team: Docs Engineering

## Transformers

Currently implemented transformers:
- **REST API transformer** (`rest-transformer.ts`) - Converts REST API autogenerated content
- **GraphQL transformer** (`graphql-transformer.ts`) - Converts GraphQL API autogenerated content
- **Audit logs transformer** (`audit-logs-transformer.ts`) - Converts audit log tables to markdown

### Known limitations
- Some autogenerated content types don't have transformers yet
- Cache invalidation is manual
- No built-in rate limiting
- No built-in rate limiting (uses Fastly instead)
- Limited API versioning
6 changes: 6 additions & 0 deletions src/fixtures/fixtures/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: This is an index page
intro: 'I am missing a children frontmatter property'
versions:
fpt: '*'
---
4 changes: 2 additions & 2 deletions src/fixtures/fixtures/sample-toc-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
title: A sample TOC
versions:
free-pro-team: '*'
children:
- /article-one
---

{% link_in_list /sample-article %}
8 changes: 7 additions & 1 deletion src/frame/components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type EnterpriseServerReleases = {
oldestSupported: string
nextDeprecationDate: string
supported: Array<string>
releasesWithOldestDeprecationDate: Array<string>
}

export type MainContextT = {
Expand Down Expand Up @@ -193,7 +194,11 @@ export const getMainContext = async (req: any, res: any): Promise<MainContextT>

// To know whether we need this key, we need to match this
// with the business logic in `DeprecationBanner.tsx` which is as follows:
if (req.context.currentVersion.includes(req.context.enterpriseServerReleases.oldestSupported)) {
if (
req.context.enterpriseServerReleases.releasesWithOldestDeprecationDate.includes(
req.context.currentRelease,
)
) {
reusables.enterprise_deprecation = {
version_was_deprecated: req.context.getDottedData(
'reusables.enterprise_deprecation.version_was_deprecated',
Expand Down Expand Up @@ -264,6 +269,7 @@ export const getMainContext = async (req: any, res: any): Promise<MainContextT>
'oldestSupported',
'nextDeprecationDate',
'supported',
'releasesWithOldestDeprecationDate',
]),
enterpriseServerVersions: req.context.enterpriseServerVersions,
error: req.context.error ? req.context.error.toString() : '',
Expand Down
57 changes: 0 additions & 57 deletions src/frame/lib/get-toc-items.ts

This file was deleted.

12 changes: 8 additions & 4 deletions src/frame/lib/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import getApplicableVersions from '@/versions/lib/get-applicable-versions'
import generateRedirectsForPermalinks from '@/redirects/lib/permalinks'
import getEnglishHeadings from '@/languages/lib/get-english-headings'
import { getAlertTitles } from '@/languages/lib/get-alert-titles'
import getTocItems from './get-toc-items'
import Permalink from './permalink'
import { renderContent } from '@/content-render/index'
import processLearningTracks from '@/learning-track/lib/process-learning-tracks'
Expand Down Expand Up @@ -100,6 +99,8 @@ class Page {
public rawRecommended?: string[]
public autogenerated?: string
public featuredLinks?: FeaturedLinksExpanded
public children?: string[]
public layout?: string

// Derived properties
public languageCode!: string
Expand All @@ -111,7 +112,6 @@ class Page {
public documentType: string
public applicableVersions: string[]
public permalinks: Permalink[]
public tocItems?: any[]
public communityRedirect?: CommunityRedirect
public detectedPlatforms: string[] = []
public includesPlatformSpecificContent: boolean = false
Expand Down Expand Up @@ -259,9 +259,13 @@ class Page {
this.applicableVersions,
)

// Ensure 'children' frontmatter exists if this is a standard index page
if (this.relativePath.endsWith('index.md')) {
// get an array of linked items in product and category TOCs
this.tocItems = getTocItems(this)
if (!this.children && !/(search|early-access)\/.*index.md/.test(this.relativePath)) {
if (this.layout !== 'journey-landing') {
throw new Error(`${this.fullPath} must contain 'children' frontmatter.`)
}
}
}

// if this is an article and it doesn't have showMiniToc = false, set mini TOC to true
Expand Down
2 changes: 1 addition & 1 deletion src/frame/middleware/context/generic-toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise
}

return await Promise.all(
node.childPages.filter(filterHidden).map(async (child) => {
(node.childPages || []).filter(filterHidden).map(async (child) => {
const { page } = child
const title = await page.renderProp('rawTitle', context, { textOnly: true })
const octicon = page.octicon ?? null
Expand Down
Loading
Loading