Code Editor
Use Git-based workflows and MDX in your preferred code editor to write, organize, and publish documentation with Documentation.AI.
Overview
The code editor workflow lets you write and manage documentation in your preferred development environment (for example, VS Code, Cursor, or Windsurf). You work with .mdx files locally, commit changes to Git, and Documentation.AI builds and deploys from your connected repository.
Use this page as the single reference for:
- When to use the code editor workflow
- How to write docs in MDX with Documentation.AI components
- Recommended Git workflows for collaboration and previews
- How to organize files and navigation with
documentation.json
If you prefer visual editing, real-time collaboration, and publishing without Git, see the Web Editor.
When to use the code editor workflow
Choose the code editor workflow when you want:
-
Developer workflows
Use Git branching, pull requests, code reviews, and CI-style checks. -
Bulk editing and refactors
Run project-wide search and replace, automate changes with scripts, and refactor content across many files. -
Integration with code
Keep docs in the same repo as your product code, or in a dedicated docs repo with the same tooling (linting, formatting, CI). -
Extension ecosystem
Use editor extensions for markdown linting, spell-check, formatting, and AI assistance. -
Offline work
Edit docs without internet access and push changes when you are back online.
Use the Web Editor when you need:
- Quick, one-off content edits without touching Git
- Non-technical contributors editing docs
- Visual content editing and drag-and-drop media management
Set up your project
1. Connect your repository
- In the Documentation.AI dashboard, open Settings.
- Connect your Git provider (GitHub, GitLab, or another supported provider).
- Select the repository that contains (or will contain) your documentation.
- Choose the branch to deploy (typically
mainormaster).
After the connection, pushes to the configured branch trigger an automatic build and deployment.
2. Clone and open in your editor
Clone your docs repository locally:
git clone https://github.com/your-org/docs.git
cd docs
Open the folder in your editor:
- VS Code:
code .or use File → Open Folder - Cursor:
cursor .or drag the folder into the app
Project structure and navigation
Documentation.AI reads your .mdx files and documentation.json to generate your site.
A typical structure:
docs/
├── documentation.json # Site configuration and navigation
├── getting-started/
│ ├── introduction.mdx
│ └── quickstart.mdx
├── api/
│ ├── authentication.mdx
│ └── openapi.yaml # Optional OpenAPI for API docs
└── guides/
└── integrations.mdx
File and folder naming guidelines
To keep your docs maintainable:
- Use lowercase-with-hyphens for filenames and directories
api-authentication.mdxinstead ofAPIAuthentication.mdx
- Keep a shallow structure where possible
- Prefer
guides/integrations.mdxover deeply nested trees
- Prefer
- Match directory structure to navigation groups
- For example, a
getting-started/folder for “Getting Started” pages
- For example, a
- Use one main concept per page
- Avoid very long “miscellaneous” pages
documentation.json basics
The documentation.json file controls:
- Sidebar navigation (groups, pages, and their order)
- Icons and labels in navigation
- Some site-wide configuration and metadata
A minimal example of adding a new page:
{
"tabs": [
{
"tab": "Documentation",
"groups": [
{
"group": "Getting Started",
"pages": [
{ "title": "Introduction", "path": "getting-started/introduction" },
{ "title": "Quickstart", "path": "getting-started/quickstart" }
]
}
]
}
]
}
Best practices:
- Keep
pathvalues aligned with your file tree (for example,getting-started/introduction→getting-started/introduction.mdx). - Prefer absolute paths from the docs root for internal links (for example,
[Quickstart](/getting-started/quickstart)). - Update
documentation.jsonwhen you add, rename, or remove pages so navigation stays in sync.
For more advanced organization patterns, see the broader Organize docs.
Writing docs in MDX
MDX fundamentals
Each page is an .mdx file with frontmatter and content:
---
title: API Authentication
description: Learn how to authenticate with our API
---
## API authentication
Authenticate using a bearer token in the `Authorization` header.
```bash
curl https://api.example.com/data \
-H "Authorization: Bearer $TOKEN"
```
Guidelines:
- Always include at least
titleanddescriptionin frontmatter. - Use markdown for headings, text, lists, and tables.
- Use MDX components (JSX-style tags) for richer patterns like callouts, steps, and parameter tables.
Using Documentation.AI components
Documentation.AI ships a set of MDX components tailored for docs. Common examples:
<Callout kind="info">
Tokens expire after 24 hours; refresh them using the `/auth/refresh` endpoint.
</Callout>
<ParamField path="userId" param-type="string" required="true">
Unique identifier for the user
</ParamField>
For grouped or multi-step content:
<Steps>
<Step title="Create an API token" icon="key">
Go to your account settings, then create a new token with read access.
</Step>
<Step title="Add token to your environment" icon="terminal">
Store the token in an environment variable such as `API_TOKEN`.
</Step>
</Steps>
For code in multiple languages:
<CodeGroup tabs="JavaScript,Python">
```javascript
const user = await getUser(userId)
```
```python
user = get_user(user_id)
```
</CodeGroup>
Component references:
Internal links
Use absolute paths from the docs root:
- ✅
[Quickstart](/getting-started/quickstart) - ✅
[Web Editor](/write-and-publish/web-editor) - ❌
../getting-started/quickstart(relative paths are harder to maintain)
This keeps links stable even if you move files or change navigation groups.
Git workflow and collaboration
Documentation.AI uses your Git repository as the single source of truth. A typical cycle:
- Edit content locally in your editor.
- Commit changes to a branch.
- Push to your Git provider.
- Open a pull request (PR).
- Documentation.AI builds previews for the PR and deploys when merged.
Recommended branch workflow
Create a feature branch
Start from your main branch:
git checkout main
git pull
git checkout -b add-webhook-docs
Use descriptive branch names such as fix-typos-billing-page or add-api-errors-doc.
Edit and preview locally
- Create or edit
.mdxfiles. - Update
documentation.jsonif navigation changes. - Use your editor's markdown preview (for example, Ctrl+Shift+V in VS Code) for a quick content view.
Commit with clear messages
git add .
git commit -m "Add webhook setup documentation"
Keep commits focused on related changes to make reviews easier.
Push and open a PR
git push origin add-webhook-docs
Then open a pull request in your Git provider. Documentation.AI automatically builds a preview for the PR so reviewers can see the rendered docs.
Review and merge
- Use the preview build to verify formatting, navigation, and links.
- Address review comments and push updates to the same branch.
- When ready, merge the PR into the deployment branch (for example,
main).
Documentation.AI then runs a production build and publishes changes.
Git workflow best-practice checklist
- Ensure frontmatter
titleanddescriptionare set and accurate - Check that new or renamed pages are added to
documentation.json - Run spell-check or linting in your editor, if configured
- Verify internal links use absolute paths (for example,
/getting-started/quickstart) - Preview markdown in your editor for obvious formatting issues
Use feature branches and PRs even for documentation-only changes. Documentation.AI generates preview builds for pull requests, which helps reviewers catch structural or navigation issues before they reach production.
Troubleshooting and common issues
If something looks wrong after a change:
-
Navigation is missing or out of order
- Check the corresponding
pathentries indocumentation.json. - Make sure filenames and directory names match the
pathvalues.
- Check the corresponding
-
Page builds but content is broken
- Look for invalid MDX (for example, unclosed components or unescaped
{in prose). - Ensure all components use valid props (for example,
kind="info"on<Callout>).
- Look for invalid MDX (for example, unclosed components or unescaped
-
Deployment did not update
- Confirm that your changes were merged into the configured deployment branch.
- Verify that the latest commit triggered a build in your Documentation.AI project.
For deeper debugging, see the general Troubleshoot build failures guide.
Summary
Use the code editor workflow when you want Git-based, developer-friendly documentation:
- Write in
.mdxusing Documentation.AI components. - Organize files to match navigation, and keep
documentation.jsonin sync. - Use branches, commits, and PRs to collaborate, with preview builds for each change.
- Let Documentation.AI handle builds and deployments from your main branch.
For teams that prefer WYSIWYG editing or non-Git workflows, pair this with the Web Editor so both technical and non-technical contributors can work where they are most productive.
Last updated 1 day ago