콘텐츠로 이동

GitBook Cheat Sheet

Overview

GitBook is a modern documentation platform that enables teams to create, edit, and publish beautiful documentation sites. It combines a web-based editor with Git synchronization, allowing technical and non-technical team members to collaborate using either the visual editor or Markdown files in a Git repository. GitBook handles hosting, search, and custom domains automatically.

GitBook supports rich content blocks, embedded API references, OpenAPI integration, custom branding, visitor authentication, and analytics. It is widely used for product documentation, internal knowledge bases, API references, and engineering handbooks.

Getting Started

Organization Structure

Organization
├── Spaces (individual doc sites)
│   ├── Product Docs
│   ├── API Reference
│   └── Internal Wiki
├── Collections (grouping of spaces)
│   └── Developer Portal
│       ├── Getting Started
│       └── SDK Guides
└── Members and Teams

Content Editing

Keyboard Shortcuts

ShortcutAction
Ctrl+KQuick find / command palette
Ctrl+NNew page
Ctrl+SSave changes
Ctrl+BBold text
Ctrl+IItalic text
Ctrl+Shift+KInsert link
Ctrl+EInline code
Ctrl+Shift+1Heading 1
Ctrl+Shift+2Heading 2
Ctrl+Shift+3Heading 3
/Slash command (insert block)

Content Blocks

BlockDescription
ParagraphStandard text
HeadingH1, H2, or H3
Code blockSyntax-highlighted code
HintInfo, warning, danger, success callouts
TableData table
TabsTabbed content sections
ExpandableCollapsible content
API methodREST API endpoint documentation
OpenAPIImport OpenAPI specification
EmbedURL embed (YouTube, Figma, etc.)
DrawingInline diagram tool
MathLaTeX math equations
ImageImage upload or URL
FileUploadable file

Hint Blocks

{% hint style="info" %}
Informational hint.
{% endhint %}

{% hint style="warning" %}
Warning hint.
{% endhint %}

{% hint style="danger" %}
Danger callout.
{% endhint %}

{% hint style="success" %}
Success message.
{% endhint %}

Tabs

{% tabs %}
{% tab title="npm" %}
npm install my-package
{% endtab %}
{% tab title="yarn" %}
yarn add my-package
{% endtab %}
{% endtabs %}

Git Sync

File Structure in Git

docs/
├── README.md
├── SUMMARY.md
├── getting-started/
│   ├── README.md
│   ├── installation.md
│   └── configuration.md
├── api-reference/
│   ├── README.md
│   └── endpoints.md
└── .gitbook/
    └── assets/

SUMMARY.md (Navigation)

# Table of contents

* [Welcome](README.md)

## Getting Started

* [Installation](getting-started/installation.md)
* [Configuration](getting-started/configuration.md)

## API Reference

* [Endpoints](api-reference/endpoints.md)

Change Requests

StepDescription
CreateStart a change request from any page
EditMake changes in isolated branch
ReviewTeam members review and comment
MergeMerge approved changes into main content

Customization

SettingOptions
LogoUpload custom logo
ColorsPrimary color, header, sidebar
FaviconCustom browser tab icon
Custom domainMap your own domain
Header linksAdd navigation links

Custom Domain Setup

  1. Go to Space settings then Custom domain
  2. Enter your domain (e.g., docs.example.com)
  3. Add CNAME record pointing to hosting.gitbook.io
  4. SSL certificate is provisioned automatically

API

# List spaces
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://api.gitbook.com/v1/orgs/ORG_ID/spaces

# Get page content
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://api.gitbook.com/v1/spaces/SPACE_ID/content

# Search content
curl -H "Authorization: Bearer YOUR_TOKEN" \
  "https://api.gitbook.com/v1/spaces/SPACE_ID/search?query=authentication"

Integrations

IntegrationFeatures
GitHubBidirectional sync
GitLabBidirectional sync
SlackNotifications for changes
Google AnalyticsTrack visitor behavior
FigmaEmbed design files
PlausiblePrivacy-friendly analytics

Advanced Features

OpenAPI Integration

Import OpenAPI/Swagger specs to auto-generate interactive API documentation with request/response examples.

Visitor Authentication

MethodDescription
PublicAnyone can access
UnlistedOnly accessible via direct link
Share linksPassword-protected share links
Visitor authSSO-based authentication

Troubleshooting

IssueSolution
Git sync failingCheck repository permissions; verify branch exists
Changes not publishingEnsure change request is merged
Custom domain SSL errorVerify CNAME record; wait up to 24 hours
Images not loadingCheck file paths; re-upload assets
Search not finding contentWait for indexing
SUMMARY.md not reflectingCheck Markdown syntax; check indentation
Merge conflictsResolve in Git; re-sync from repository
Slow page loadOptimize images; reduce embedded content