Skip to content

Commit

Permalink
(docs) Add Building Your Docs section (#3698)
Browse files Browse the repository at this point in the history
* Write Building Your Docs sections

* add custom CSS

* define multiple sdk group names

* multiple group names
  • Loading branch information
dannysheridan committed May 27, 2024
1 parent f379fc7 commit 0f3b1ce
Show file tree
Hide file tree
Showing 14 changed files with 502 additions and 348 deletions.
92 changes: 31 additions & 61 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ instances:
owner: fern-api
repo: fern
branch: main
# - url: fern-beta.docs.buildwithfern.com/learn
# custom-domain: staging.buildwithfern.com/learn
title: Fern

tabs:
Expand Down Expand Up @@ -118,7 +116,7 @@ navigation:
- page: Auto-Pagination
path: ./pages/sdks/features/auto-pagination.mdx
icon: pro
- page: OAuth
- page: OAuth token refresh
path: ./pages/sdks/features/oauth.mdx
icon: pro
- page: Retries with backoff
Expand Down Expand Up @@ -148,8 +146,6 @@ navigation:
- page: WebSockets
path: ./pages/sdks/features/websockets.mdx
icon: pro
# - page: OAuth token refresh
# path: ./pages/sdks/features/dummy.mdx
# icon: pro
# - page: Object oriented SDKs
# path: ./pages/sdks/features/dummy.mdx
Expand All @@ -160,37 +156,6 @@ navigation:
# - page: GitHub integration
# path: ./pages/sdks/features/dummy.mdx
# icon: pro

# - section: Other generators
# contents:
# - section: Server-side
# contents:
# - page: Express.js
# path: ./pages/fern-sdks/other-generators/server-side/express.mdx
# slug: express
# - page: FastAPI
# path: ./pages/fern-sdks/other-generators/server-side/fastapi.mdx
# slug: fastapi
# - page: Spring
# path: ./pages/fern-sdks/other-generators/server-side/spring.mdx
# - section: Specification
# slug: spec
# contents:
# - page: OpenAPI generator
# slug: openapi
# path: ./pages/fern-sdks/other-generators/spec/openapi-generator.mdx
# - page: Postman Collection generator
# slug: postman
# path: ./pages/fern-sdks/other-generators/spec/postman-collection.mdx
# - section: Guides
# contents:
# - page: Publish to Maven Central
# path: ./pages/fern-sdks/guides/publish-to-maven-central.mdx
# slug: publish-maven
# - page: Update SDKs with Fern's GitHub Bot
# path: ./pages/fern-sdks/guides/github-bot.mdx
# slug: github-bot
# icon:
- tab: docs
layout:
- section: Getting Started
Expand All @@ -201,33 +166,24 @@ navigation:
- page: Showcase
slug: showcase
path: ./pages/docs/introduction/showcase.mdx
- page: Local Development
slug: development
path: ./pages/docs/introduction/development.mdx
- page: Project Structure
slug: project-structure
path: ./pages/docs/introduction/project-structure.mdx
- section: Configuration
slug: config
contents:
- page: Overview
path: ./pages/fern-docs/config/config-overview.mdx

- section: Building Your Docs
contents:
- page: Navigation
path: ./pages/fern-docs/config/navigation.mdx
- page: PR previews
slug: previews
path: ./pages/fern-docs/config/previews.mdx
- section: Customize branding
slug: branding
contents:
- page: Colors, fonts, and background image
path: ./pages/fern-docs/config/branding/colors-fonts-background-image.mdx
slug: colors-fonts-background-image
- page: Logo and favicon
path: ./pages/fern-docs/config/branding/logo-and-favicon.mdx
- page: Custom domain
path: ./pages/fern-docs/config/branding/custom-domain.mdx
- section: Write content
path: ./pages/docs/building-your-docs/navigation.mdx
- page: Customize Styling
path: ./pages/docs/building-your-docs/styling.mdx
- page: Pull Request Preview
path: ./pages/docs/building-your-docs/pr-preview.mdx
- page: Local Development
path: ./pages/docs/building-your-docs/local-development.mdx
- page: Custom Domain
path: ./pages/docs/building-your-docs/custom-domain.mdx

- section: Writing Content
slug: content
contents:
- page: Write Markdown content
Expand All @@ -237,7 +193,8 @@ navigation:
path: ./pages/fern-docs/content/front-matter.mdx
- page: Reusable snippets
path: ./pages/fern-docs/content/reusable-snippets.mdx
- section: API references

- section: API References
contents:
- page: Generate API reference
path: ./pages/fern-docs/content/generate-api-ref.mdx
Expand All @@ -256,43 +213,56 @@ navigation:
- section: Components
slug: components
contents:
- page: Accordion
- page: Overview
path: ./pages/docs/components/overview.mdx
- page: Accordions
path: ./pages/docs/components/accordions.mdx
slug: accordions
icon: "square-caret-down"
- page: Accordion Groups
path: ./pages/docs/components/accordion-groups.mdx
icon: table-rows
slug: accordion-groups
- page: Aside
path: ./pages/docs/components/asides.mdx
icon: align-right
slug: aside
- page: Callouts
path: ./pages/docs/components/callouts.mdx
icon: "circle-exclamation"
slug: callouts
- page: Cards
path: ./pages/docs/components/cards.mdx
icon: "rectangle"
slug: cards
- page: Card Groups
path: ./pages/docs/components/card-groups.mdx
icon: "rectangles-mixed"
slug: card-groups
- page: Code Blocks
path: ./pages/docs/components/code-blocks.mdx
slug: code-blocks
icon: "rectangle-code"
- page: Steps
path: ./pages/docs/components/steps.mdx
icon: "arrow-progress"
slug: steps
- page: Frames
path: ./pages/docs/components/frames.mdx
icon: "frame"
slug: frames
- page: Tabs
path: ./pages/docs/components/tabs.mdx
icon: "window-restore"
slug: tabs
- page: Endpoint Request Snippet
path: ./pages/docs/components/endpoint-request-snippet.mdx
icon: "turn-up"
slug: request-snippet
- page: Endpoint Response Snippet
path: ./pages/docs/components/endpoint-response-snippet.mdx
icon: "turn-down"
slug: response-snippet
- tab: cli-api
layout:
- section: CLI Reference
Expand Down
2 changes: 1 addition & 1 deletion fern/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization": "fern",
"version": "0.26.10"
"version": "0.29.0"
}
14 changes: 14 additions & 0 deletions fern/pages/api-definition/openapi/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ paths:
x-fern-sdk-method-name: create_user
```

If you add more than one `x-fern-sdk-group-name` extension, then the generated SDK will nested group names. The order of the group names is preserved in the generated SDK method.

For example, the following OpenAPI will generate `client.admin.users.create()`:

```yaml title="openapi.yaml"
paths:
/users:
post:
x-fern-sdk-group-name:
- admin
- users
x-fern-sdk-method-name: create
```

## Authentication overrides

For authentication within your SDK, you may want to customize the:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Development'
description: 'Preview changes before deploying to production'
title: Local Development
description: Preview your documentation locally with Fern. Access your docs on your local server at port 3000, hot-reloading as you edit your markdown and OpenAPI files.
---

<Info>
Expand Down Expand Up @@ -101,7 +101,6 @@ jobs:
</AccordionGroup>

<Warning>
Note that search functionality is not enabled on documentation previews. It is only
enabled on production deployments.
Note that search functionality is not enabled on documentation previews. It is only enabled on production deployments.
</Warning>

File renamed without changes.
68 changes: 68 additions & 0 deletions fern/pages/docs/building-your-docs/pr-preview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Pull request previews
description: Fern's PR previews feature lets you preview changes to your docs from pull requests before merging to the live docs site. Use manually or in GitHub Actions.
---

`PR previews` offer a way to preview changes from pull requests (PRs) before merging code to a production branch. This is useful for reviewing documentation changes before publishing them to your live documentation site. Use manually or in GitHub Actions.

## Usage

```bash
fern generate --docs --preview
```

## Example

```bash
fern generate --docs --preview

[docs]: Found 0 errors and 1 warnings. Run fern check --warnings to print out the warnings.
[docs]: Published docs to https://fern-preview-ce3459d6-8a76-4747-963a-33c71ee13959.docs.buildwithfern.com
┌─
│ ✓ docs.example.com
└─
```

## Usage in GitHub Actions

The following is a GitHub Action workflow that generates a preview URL for every pull request.x

<CodeBlock title = ".github/workflows/preview-docs.yml">
```yaml
name: preview-docs

on:
pull_request

jobs:
run:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Generate preview URL
id: generate-docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT=$(fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > preview_url.txt
- name: Comment URL in PR
uses: thollander/actions-comment-pull-request@v2.4.3
with:
filePath: preview_url.txt
```
</CodeBlock>

## Link expiration

Preview links do not expire. However, the time to live (TTL) is subject to change in the future.
Loading

0 comments on commit 0f3b1ce

Please sign in to comment.