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:
-
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") -
Image Management:
# Move SVG files to content/images directory MoveFiles("*.svg", "content/images") -
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 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/")
Format Link Generation
# 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
-
Initialization:
- Load metadata from meta.yaml
- Create output directories
- Copy required assets
-
Content Processing:
- Process markdown content
- Fix image references
- Add format links
-
Asset Management:
- Copy cover images
- Move SVG files
- Organize content images
-
Index Generation:
- Create index.md
- Add cover image
- Include format links
- Add source file links
Error Handling
The WikiJS builder includes error handling for:
- Missing cover images
- Invalid file paths
- File copy/move operations
- Markdown processing errors
Best Practices
-
Image Organization:
- Keep all images in content/images/
- Use relative paths in markdown
- Support multiple cover formats
-
Link Management:
- Use relative paths for all links
- Include all available formats
- Verify file existence before linking
-
Content Structure:
- Maintain clear hierarchy
- Use consistent formatting
- Include navigation aids
Future Enhancements
-
Automated Publishing:
- Direct WikiJS API integration
- Automated content updates
- Version tracking
-
Enhanced Navigation:
- Table of contents generation
- Cross-reference linking
- Search optimization
-
Asset Optimization:
- Image compression
- SVG optimization
- Lazy loading support