BUCKYVERSE

This document details the integration between the Codexis book building system and WikiJS, providing a documentation and content distribution platform for the generated books.

Overview

The WikiJS integration is handled by the WikiJSBuilder component, which creates WikiJS-compatible markdown content with proper linking to all generated book formats. It's designed to work seamlessly within the book building pipeline.

Architecture

The integration follows the builder pattern within the main system architecture:

┌─────────────────────────┐
│  BookBuilderOrchestrator│
└─────────────┬───────────┘
              │
┌─────────────▼───────────┐
│  WikiJSBuilder          │  WikiJS content generation
└─────────────┬───────────┘
              │
┌─────────────▼───────────┐
│  MarkdownBuilder        │  Base markdown generation
└─────────────┬───────────┘
              │
┌─────────────▼───────────┐
│  FileStructureSetup     │  Directory management
└─────────────────────────┘

Content Generation

The WikiJS builder performs the following tasks:

  1. Cover Image Processing:

    # Copy cover images to content/images directory
    CopyFile("content/images/cover.jpg", outputDirectory + "/content/images")
    CopyFile("content/images/cover.png", outputDirectory + "/content/images")
    CopyFile("content/images/cover.pdf", outputDirectory + "/content/images")
    
  2. Image Management:

    # Move SVG files to content/images directory
    MoveFiles("*.svg", "content/images")
    
  3. Index File Creation:

    # Components of the index.md file
    - Cover image display
    - Book content (from markdown)
    - Links to source scans (if available)
    - Links to all generated formats
    

Directory Structure

The WikiJS content is organized as follows:

manuscript/
└── output/
    └── markdown-wikijs/
        ├── index.md          # Main entry point
        ├── content/
        │   └── images/       # Book images
        └── assets/          # Additional resources

Content Structure

Index Page Format

The index.md file is structured as:

![Book Title cover image](content/images/cover.jpg)

# Book Content
[Content from markdown conversion]

# Source Files
- [PDF Scan](book-name-scan.pdf) [Optional]

# eBook Formats 
- [EPUB](book-name.epub)
- [KFX](book-name.kfx)
- [MOBI](book-name.mobi)
- [PDF](book-name.pdf)

Implementation Details

Image Path Processing

# Fix image directory paths in content
srcImg = "content/images/"
srcSvg = "../ebooks/"
text = ReadFile(mdFileName)
newImgSrc = ReplaceAll(text, srcImg, "content/images/")
newSvgSrc = ReplaceAll(newImgSrc, srcSvg, "content/images/")
# Create links to various eBook formats
ebookFileList = "# eBook Formats \n" +
              "- [epub](" + fileName + ".epub)\n" +
              "- [kfx](" + fileName + ".kfx)\n" +
              "- [mobi](" + fileName + ".mobi)\n" +
              "- [pdf](" + fileName + ".pdf)\n"

Configuration

Required metadata in meta.yaml:

file_name: "book-name"
title: "Book Title"
cover_image: "cover.jpg"

Integration Process

  1. Initialization:

    • Load metadata from meta.yaml
    • Create output directories
    • Copy required assets
  2. Content Processing:

    • Process markdown content
    • Fix image references
    • Add format links
  3. Asset Management:

    • Copy cover images
    • Move SVG files
    • Organize content images
  4. Index Generation:

    • Create index.md
    • Add cover image
    • Include format links
    • Add source file links

Error Handling

The WikiJS builder includes error handling for:

Best Practices

  1. Image Organization:

    • Keep all images in content/images/
    • Use relative paths in markdown
    • Support multiple cover formats
  2. Link Management:

    • Use relative paths for all links
    • Include all available formats
    • Verify file existence before linking
  3. Content Structure:

    • Maintain clear hierarchy
    • Use consistent formatting
    • Include navigation aids

Future Enhancements

  1. Automated Publishing:

    • Direct WikiJS API integration
    • Automated content updates
    • Version tracking
  2. Enhanced Navigation:

    • Table of contents generation
    • Cross-reference linking
    • Search optimization
  3. Asset Optimization:

    • Image compression
    • SVG optimization
    • Lazy loading support