Skip to main content

BookStack – Book Change Comparison & Reporting

1. Objective

Develop functionality that allows users to compare the current content of a Book in BookStack against a previously saved baseline version of that Book.

The objective is to identify and report all changes made since the baseline was established, providing users with a clear and structured overview of modifications across the entire Book.

The functionality should enable users to generate a consolidated change report, highlighting additions, modifications and deletions at both Page and content level.

The primary output will be a downloadable Word or PDF document.

2. Proposed Functionality

The proposed solution consists of three main components.

2.1. Establishing a Baseline

Users should be able to create a baseline version of a Book at a selected point in time.

The baseline should represent a complete snapshot of the Book, including:

  • Book structure and hierarchy.

  • Chapters and their order.

  • Pages and their order.

  • Page titles.

  • Page content.

The baseline should be stored independently of the live BookStack content, ensuring that subsequent changes to the Book do not affect the original reference version.

Each baseline should contain metadata, including:

  • Book ID and Book title.

  • Baseline creation date and time.

  • User who created the baseline.

  • Baseline version or reference name.

Users should be able to create a new baseline when required. Existing baselines should remain available for future comparisons.

2.2. Comparing the Current Book Against the Baseline

Users should be able to select a Book and compare its current content against a previously established baseline.

The comparison engine should analyse the Book structure and content, identifying the following types of changes:

Change typeDescription
New ChapterA Chapter has been added since the baseline.
Deleted ChapterA Chapter present in the baseline no longer exists.
New PageA new Page has been added since the baseline.
Deleted PageA Page present in the baseline has been removed.
Modified PageThe content of an existing Page has changed.
Unchanged PageNo relevant changes have been identified.

For modified Pages, the comparison should operate at text level rather than simply identifying that a Page has changed.

The comparison engine should identify:

  • Added text.

  • Removed text.

  • Modified paragraphs.

  • Changes to headings and lists, where technically feasible.

Changes should be identified by comparing the actual content of the baseline and current Page.

Where possible, Pages should be matched using their unique BookStack Page IDs rather than their titles, ensuring that renaming a Page does not incorrectly result in a deleted Page and a newly created Page.

The comparison should also account for changes in the Book structure, including Pages moved between Chapters or changes in their order.

3. Change Report Generation

Following the comparison, users should be able to generate a consolidated change report.

The report should be available in:

  • Microsoft Word (.docx)

  • PDF (.pdf)

The report should contain the following sections.

3.1. Report Overview

A summary of the comparison, including:

  • Book title.

  • Baseline reference and creation date.

  • Comparison date.

  • Number of new Chapters and Pages.

  • Number of deleted Chapters and Pages.

  • Number of modified Pages.

  • Number of unchanged Pages.

3.2. Change Summary

A structured overview of all identified changes, grouped by Chapter.

For each affected Page, the report should indicate:

  • Page title.

  • Type of change.

  • Nature of the modification.

This section should provide users with a quick overview of the scope of changes without having to review the entire document.

3.3. Detailed Change Comparison

For modified Pages, the report should include the actual textual differences between the baseline and current version.

The preferred presentation is an inline comparison using colour-coded changes:

  • Green: Added text.

  • Red: Deleted text.

  • No highlighting: Unchanged text.

For example:

Original text (Baseline):

All goods must be declared upon arrival.

Current text:

All goods must be declared upon arrival, unless an applicable customs simplification permits otherwise.

The report should display the original sentence with the deleted text and the new sentence with the added text clearly highlighted.

For entirely new Pages, the report should indicate that the Page is new and optionally include its complete content.

For deleted Pages, the report should identify the Page and indicate that it has been removed since the baseline. Optionally, the original content can be included in the report.

3.4. Unchanged Content

Unchanged Pages should not be included in the detailed comparison section.

This is important to keep the report focused on relevant changes and prevent unnecessarily large reports.

4. What the Change Report Could Look Like

The following is an illustrative example of the proposed report layout and presentation.


BOOK CHANGE REPORT

Book: Customs & Excise Manual

Baseline: 01 January 2026

Compared: 26 November 2026

Reference: Baseline v1

4.1. Change Overview

Change categoryNumber
New Pages3
Modified Pages5
Deleted Pages1
Unchanged Pages24

4.2. Change Summary

The changes are grouped by Chapter, providing a structured overview of all modifications.

Chapter / PageChangeDescription
Chapter 1 – General / Customs ProceduresModifiedText amended in the declaration requirements section.
Chapter 2 – Import Operations / Import DocumentationNewA new Page has been added.
Chapter 3 – Excise / Legacy GuidanceDeletedPage removed since the baseline.

4.3. Detailed Comparison

Chapter 1 – General

Page: Customs Procedures

The following example illustrates how the report could present textual changes within a modified Page.

<font color="#A52A2A">REMOVED FROM BASELINE:</font>

<font color="#A52A2A">All goods must be declared upon arrival.</font>

<font color="#176B36">ADDED IN CURRENT VERSION:</font>

<font color="#176B36">All goods must be declared upon arrival, unless an applicable customs simplification permits otherwise.</font>

Presentation principle:

  • Red highlighting identifies text that has been removed.

  • Green highlighting identifies text that has been added.

  • Unchanged text remains unhighlighted.

For longer Pages, the comparison should ideally be presented inline, preserving the original paragraph structure and showing additions and deletions in context.

New Page example

Chapter 2 – Import Operations

Page: Import Documentation

Status: New Page

A new Page has been added since the baseline. The report may include the complete content of the new Page.

Deleted Page example

Chapter 3 – Excise

Page: Legacy Guidance

Status: Deleted Page

This Page existed in the baseline but is no longer present in the current Book. The original content may optionally be included for reference.


Unchanged Pages are excluded from the detailed comparison. The report continues with each modified, new or deleted Page, organised by Chapter.

5. User Interface and Workflow

The functionality could be implemented as a separate action within the BookStack interface or as a standalone administrative tool.

A proposed workflow:

Step 1 – Select Book

The user selects the Book to be analysed.

Step 2 – Manage Baseline

The user can either:

  • Create a new baseline from the current Book.

  • Select an existing baseline.

Step 3 – Run Comparison

The system compares the current Book against the selected baseline.

Step 4 – Review Changes

Before generating the report, the user is presented with a summary of the identified changes.

Step 5 – Generate Report

The user selects the desired output format (Word or PDF) and downloads the generated report.

6. Technical Implementation

The preferred approach is to implement the functionality as an additional module or external service using the BookStack REST API.

The proposed technical components are:

A. Book Content Extraction

Retrieve the Book structure and associated Chapters and Pages through the BookStack API.

Extract and store the relevant content, including:

  • Page IDs.

  • Page titles.

  • Chapter hierarchy.

  • Page order.

  • Page content.

B. Baseline Storage

Store a snapshot of the extracted Book content in a separate database or structured storage location.

The stored baseline must remain independent of subsequent changes to the live BookStack environment.

C. Comparison Engine

Develop a comparison engine that:

  • Matches Pages using their unique identifiers.

  • Identifies new and deleted Chapters and Pages.

  • Compares the content of existing Pages.

  • Identifies textual additions and deletions.

  • Detects structural changes, including moved Pages.

For textual comparison, a standard diff algorithm (such as Python's difflib or an equivalent library) could be used as a starting point.

HTML content should ideally be normalised before comparison to avoid reporting irrelevant changes caused by formatting, HTML attributes or other technical differences.

D. Report Generator

Generate a structured Word or PDF document based on the comparison results.

A Word document could be generated using a document-generation library, with PDF either generated directly or converted from the Word output.

The report should preserve a readable document structure, including headings, lists and paragraph formatting wherever technically feasible.

7. Additional Considerations

A few aspects should be considered during development:

  • Baseline integrity: Existing baselines must remain unchanged, even if the original Book is subsequently modified or deleted.

  • Page identification: Page IDs should be used to distinguish renamed or moved Pages from genuinely new or deleted Pages.

  • Formatting changes: The comparison should prioritise meaningful content changes rather than technical HTML differences.

  • Large Books: The solution should support Books containing a substantial number of Chapters and Pages without excessive processing time.

  • Permissions: Only users with the appropriate permissions should be able to create baselines and generate reports.

  • Repeatability: The same baseline should be reusable for multiple comparisons, allowing users to track changes over time.

8. Potential Future Enhancements

The initial implementation should focus on baseline creation, comparison and report generation.

The following enhancements could be considered at a later stage:

  • Multiple named baselines per Book.

  • Scheduled comparisons and automatic reporting.

  • Comparison between two arbitrary baselines.

  • Automatic notifications when significant changes are detected.

  • An interactive review interface showing changes directly within BookStack.

  • An option to include only selected Chapters or Pages in the report.

9. Expected Result

The expected result is a straightforward mechanism that allows users to establish a reference version of a Book and subsequently generate a comprehensive change report against its current content.

Rather than manually reviewing individual Page revisions, users can obtain a single consolidated document showing exactly what has changed throughout the Book, including additions, deletions and modifications to the actual text.

The solution should be designed to be reusable across all Books within the BookStack environment.