Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Conjob: Confluence to Markdown Scraper

A Node.js tool to scrape Confluence spaces and convert them to Markdown files while preserving the page hierarchy.

Features

  • πŸ“š Scrape entire Confluence spaces or individual spaces
  • πŸ”„ Convert Confluence storage format to Markdown
  • πŸ“ Preserve page hierarchy in directory structure
  • πŸ” Handle rate limiting with exponential backoff
  • πŸ”— Maintain page relationships and ordering

Quick Start

# Install dependencies
pnpm install

# Configure your Confluence instance
# Edit utils/index.js:
export const BASE_URL = "http://your-confluence-instance/rest/api";
export const ACCESS_TOKEN = "your-personal-access-token";

# Scrape all spaces
pnpm space:all

# Or scrape a specific space
pnpm space:single ENGINEERING

Architecture Decisions

This project follows a documented decision-making process. Key architectural decisions:

  1. API Integration

    • Native fetch with backoff
    • Centralized API client
    • Type-safe responses
  2. File Structure

    • Feature-based organization
    • Clear separation of concerns
    • Consistent patterns
  3. Error Handling

    • Centralized error handling
    • Retry mechanisms
    • Consistent error messages
  4. CLI Interface

    • Command-based interface
    • Progress feedback
    • Clear usage instructions

Project Structure

.
β”œβ”€β”€ scripts/                 # CLI Commands
β”‚   β”œβ”€β”€ all-spaces.js       # Scrape all spaces
β”‚   └── all-space-content.js # Scrape single space
β”œβ”€β”€ utils/                  # Shared Utilities
β”‚   └── index.js           # API client, helpers
└── docs/                  # Documentation
    β”œβ”€β”€ api-examples.md
    β”œβ”€β”€ api-integration.md
    β”œβ”€β”€ cli-interface.md
    β”œβ”€β”€ error-handling.md
    β”œβ”€β”€ file-structure.md

Development

# Format code
pnpm format

Output Structure

The scraper creates a directory structure that mirrors your Confluence space:

confluence_markdown/
β”œβ”€β”€ SPACE1/
β”‚   β”œβ”€β”€ home/
β”‚   β”‚   β”œβ”€β”€ index.md (Space homepage)
β”‚   β”‚   └── Other Root Pages.md
β”‚   └── Parent Page/
β”‚       β”œβ”€β”€ index.md (Parent page content)
β”‚       └── Child Page.md
└── SPACE2/
    └── ...

Configuration

Configure your Confluence instance in utils/index.js:

export const BASE_URL = "http://your-confluence-instance/rest/api";
export const ACCESS_TOKEN = "your-personal-access-token";
export const OUTPUT_DIR = "confluence_markdown";

Error Handling

The scraper handles several error cases:

  • Rate limiting (429) with exponential backoff
  • Network errors with retries
  • Invalid space keys
  • Missing configuration
  • File system errors

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

ISC

Acknowledgments

About

Confluence scraper utilities for building llms.txt.

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages