Migrate from GitBook
Migrate GitBook sections, Markdown, navigation, reusable content, variants, assets, and OpenAPI documentation to Mintlify using Git Sync or the scraper.
Export GitBook content to a Git repository with Git Sync for the most complete migration, or scrape a public GitBook site to create an initial Mintlify project.
Choose a method
Use Git Sync for the primary migration when possible. A GitBook site is made up of sections, and a section can have multiple variants, while Git Sync operates at the section level. Export every section that appears on the published site.
Export a section with Git Sync
GitBook does not provide direct Markdown downloads for individual pages. To export a section as Markdown:
Keep the synchronized repository unchanged as a migration snapshot. Create a branch or copy for your Mintlify conversion.
Migrate a public site
The -p puppeteer flag installs Puppeteer, which the scraper uses to render the site in a browser. Without Puppeteer, the scraper fetches pages without a browser and the generated navigation may be incomplete.
The scraper loads GitBook’s rendered navigation, downloads reachable images, converts common blocks, and creates a docs.json. It cannot retrieve private sections, unpublished changes, permissions, comments, or revision history.
Compare the generated project with your Git Sync export when both are available. The scrape is useful for checking rendered block conversion. The export is the better inventory of source content.
Understand the Git Sync export
GitBook normally creates or uses the following files and directories:
The paths can differ when the GitBook configuration defines another content root, home page, or summary file. Confirm your specific configuration before moving any files.
Convert SUMMARY.md navigation
SUMMARY.md is a nested Markdown list. Convert its headings and links to docs.json navigation:
Remove .md extensions from navigation paths, but do not rename every file before checking links. A page such as guides/README.md can become guides/index.mdx or remain a Markdown file with a different navigation path.
Every Mintlify page also needs frontmatter with at least a title. Add or convert frontmatter as you migrate each page.
Convert GitBook blocks
GitBook represents many blocks with {% ... %} directives. Convert these directives to Mintlify components.
GitBook exports some custom blocks as HTML because they do not have a Markdown representation. Review every HTML block to verify it functions the same in MDX.
Convert reusable content
GitBook exports reusable content into .gitbook/includes/ and references it with include directives. Convert each reusable file to a Mintlify snippet, then replace the GitBook include with an MDX import and component.
For example:
Check reusable content shared across multiple sections. GitBook assigns each reusable block a parent section that owns the content and is the only place that you can edit it. Separate section exports can therefore contain duplicate or cross-section references that need to become a single shared snippet.
Migrate sections, variants, and translations
A GitBook site publishes one or more sections, organizes related sections into groups, and uses variants for versions or languages. Choose the closest Mintlify navigation model:
Record the default variant and every variant slug before changing the domain. GitBook can omit the default variant slug from its public URL, so redirects must account for both the default and explicitly named paths.
Migrate assets and links
Copy .gitbook/assets/ into your Mintlify repository and update relative image and download paths. Review inline images that use HTML for sizing or alignment. Do not leave required production assets on GitBook unless you plan to keep that hosting after your migration.
GitBook redirects can exist in your configuration file and in site-level settings. Collect both sources and convert them to Mintlify redirects. GitBook scopes a redirect in its configuration file to one section, while a Mintlify redirect applies to the published site. Include the former section or variant prefix when necessary.
Migrate OpenAPI documentation
GitBook can store OpenAPI specifications at the organization level and place generated OpenAPI blocks in sections. The Markdown section export might not be the source of truth for these specifications.
Review your migration
Compare every exported section and SUMMARY.md entry against docs.json, then verify every section, group, variant, and language.
Search your converted files for leftover GitBook syntax: {%, {% end, .gitbook/includes, and the raw HTML blocks that GitBook exports in place of Markdown.