Root Cause of the "ewpage" Issue Identified and Fixed
After further investigation, I've identified the true root cause of the "ewpage" issue that was persisting in the EPUB output.
The Core Problem
The issue was due to two conflicting page break styles being used in the same document:
The source markdown files were already using HTML-style page breaks:
<div style="page-break-after: always;"></div>
The combine-markdown.sh script was adding LaTeX-style page breaks:
\newpage
While PDF output can handle both styles, EPUB conversion was stumbling on the LaTeX \newpage command, resulting in literal "ewpage" text appearing in the final EPUB.
The Solution
I've updated the combine-markdown.sh script to use consistent page break styles that work across all output formats:
For sections that already have page breaks in their source files, I've removed the duplicate page breaks added by the script.
For sections where we need to add page breaks (like title pages, appendices, glossary), I'm now using the HTML style that's compatible with both PDF and EPUB:
<div style="page-break-after: always;"></div>
Technical Details
The previous fix I applied (changing \\\\newpage to \\newpage) was addressing a symptom but not the underlying cause. The issue wasn't just with backslash escaping in bash, but with the inconsistent approach to page breaks across different output formats.
By using HTML-style page breaks consistently, which are supported by both PDF and EPUB formats, we avoid the conversion issues that were causing "ewpage" to appear.
Verification
The next build of the book should have proper page breaks in both PDF and EPUB formats, without any "ewpage" text appearing in either output.
This solution is more robust because it:
Uses a consistent approach to page breaks
Works across all output formats (PDF, EPUB, HTML)
Avoids duplicating page breaks that already exist in the source files
Let me know if you encounter any other issues with the build process!
Root Cause of the "ewpage" Issue Identified and Fixed
After further investigation, I've identified the true root cause of the "ewpage" issue that was persisting in the EPUB output.
The Core Problem
The issue was due to two conflicting page break styles being used in the same document:
The source markdown files were already using HTML-style page breaks:
The
combine-markdown.sh
script was adding LaTeX-style page breaks:While PDF output can handle both styles, EPUB conversion was stumbling on the LaTeX
\newpage
command, resulting in literal "ewpage" text appearing in the final EPUB.The Solution
I've updated the
combine-markdown.sh
script to use consistent page break styles that work across all output formats:For sections that already have page breaks in their source files, I've removed the duplicate page breaks added by the script.
For sections where we need to add page breaks (like title pages, appendices, glossary), I'm now using the HTML style that's compatible with both PDF and EPUB:
Technical Details
The previous fix I applied (changing
\\\\newpage
to\\newpage
) was addressing a symptom but not the underlying cause. The issue wasn't just with backslash escaping in bash, but with the inconsistent approach to page breaks across different output formats.By using HTML-style page breaks consistently, which are supported by both PDF and EPUB formats, we avoid the conversion issues that were causing "ewpage" to appear.
Verification
The next build of the book should have proper page breaks in both PDF and EPUB formats, without any "ewpage" text appearing in either output.
This solution is more robust because it:
Let me know if you encounter any other issues with the build process!