A Python-based tool that processes GitBook documentation repositories and prepares them for publication to Fluid Topics. This tool clones your GitBook repository, converts Markdown content to HTML, generates the required FTMap structure, and creates a ZIP archive ready for Fluid Topics.
- Clones or updates GitBook repositories
- Supports specific commit checkout
- Converts Markdown to HTML with special handling for:
- Tables
- Code blocks
- Hint blocks
- Lists and nested content
- Generates Fluid Topics compatible navigation map (FTMap)
- Creates a properly structured ZIP archive
- Uploads content to Fluid Topics via API
- Python 3.x
- Git installed and configured
- Access to your GitBook repository
- Fluid Topics API credentials
-
Clone this repository:
-
(Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root directory with your configuration:### GITBOOK_REPO_URL=<your-gitbook-repo-url> GITBOOK_REPO_FOLDER=<your-gitbook-repo-folder-in-local-filesystem> COMMIT_HASH=<optional-specific-commit> FLUID_TOPICS_API_KEY=<your-api-key> FLUID_TOPICS_BASE_URL=<fluid-topics-base-url> FLUID_TOPICS_SOURCE_ID=<your-source-id> PUBLICATION_TITLE=<your-publication-title>
Run the converter:
python main.py
The tool will:
- Clone/update your GitBook repository
- Convert all Markdown files to HTML
- Generate the FTMap navigation structure
- Create a ZIP archive
- Upload to Fluid Topics
Handles repository cloning and management:
- Clones GitBook repositories
- Supports checking out specific commits
- Creates a working copy for processing
Converts Markdown content to Fluid Topics compatible HTML:
- Processes tables, code blocks, and hint blocks
- Ensures proper HTML structure
- Maintains document hierarchy
Creates the navigation structure required by Fluid Topics FTML connector.
- Generates an XML-based navigation map (FTMAP) that defines the structure of your documentation
- Maps the hierarchical relationship between documents
- Preserves the GitBook navigation structure in Fluid Topics
- Handles document references and links
- Assigns unique identifiers to each content node
- Maintains the table of contents (TOC) structure
Example FTMAP structure:
<ft:map xmlns:ft="http://ref.fluidtopics.com/v3/ft#" ft:lang="en-US" ft:title="Documentation">
<ft:toc>
<ft:node ft:originId="1" ft:title="Getting Started" href="getting-started.html">
<ft:node ft:originId="2" ft:title="Installation" href="installation.html"/>
<ft:node ft:originId="3" ft:title="Configuration" href="configuration.html"/>
</ft:node>
</ft:toc>
</ft:map>
Manages communication with the Fluid Topics API.
The upload process:
- Authenticates with Fluid Topics using the API key
- Prepares the ZIP archive with HTML content, assets and the FTMAP
- Uploads the pulblication to the specified source ID(FTML Source)