asciidoctor/asciidoctor-pdf
70.1
Strong · 20 September 2026
10.5k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is the Asciidoctor PDF converter, a library that generates PDF documents from AsciiDoc source files. It leverages the Prawn rendering engine to handle page layout, typography, and image embedding, while integrating with syntax highlighters like Rouge and CodeRay for code blocks. The system supports theme-based styling, complex table rendering, and document structure features such as tables of contents and indexes, with a pluggable optimizer for post-processing output.
How it got here
2014 — Project restructuring and dependency modernization
8 changes.
The project underwent significant architectural reorganization, including the removal of legacy Prawn-based rendering components and HTML-specific templates to focus on Asciidoctor PDF. This period also involved modernizing dependencies, introducing formal gemspec and Gemfile declarations, and updating bundled fonts for expanded character coverage.
2019 — Asciidoctor PDF converter initial release
17 changes.
This period marks the initial release of the Asciidoctor PDF converter, introducing the core rendering engine built on Prawn with support for syntax highlighting, theme-based styling, and complex document structures. The work involved modularizing the build system and extension libraries to improve maintainability while establishing comprehensive test coverage and utility scripts for font handling and debugging.
2020–2022 — SVG rendering and test infrastructure
7 changes.
This period focused on enhancing SVG image handling by adding JPEG support, delegating raster images to prawn-gmagick, and implementing path validation for security. The PDF optimizer was extended to support color mode conversion and environment variable configuration, while column layout stability during page breaks was improved. Concurrently, the test suite underwent significant structural reorganization into modular components and custom matchers to improve maintainability.
Features
Add default Rouge syntax highlighting theme for Asciidoctor PDF
Introduces the AsciidoctorPDFDefault theme for the Rouge syntax highlighting engine, providing a custom color scheme for code blocks in generated PDFs. The theme is based on the Pygments pastie style but deviates by removing background colors and adjusting font weights for italics. It includes specific handling for comment preprocessing tokens and ensures compatibility with potential changes in the C++ lexer.
lib/asciidoctor/pdf/ext/rouge/themes · high confidence
Initial release of the Asciidoctor PDF converter
This change introduces the core converter implementation for generating PDF documents from AsciiDoc source. The new lib/asciidoctor/pdf/converter.rb file establishes the primary rendering engine, integrating with Prawn for page layout and text handling, and includes built-in support for syntax highlighting via Rouge, CodeRay, and Pygments. It also provides the foundational infrastructure for theme-based styling, index generation, table rendering, and document outline creation.
lib/asciidoctor/pdf · high confidence
New cop to prevent debug flags in to\_pdf calls
A new RuboCop cop (RSpec::ToPDFNoDebug) has been added to detect and flag calls to the \to\_pdf\ function that include a \debug: true\ option. This change ensures that debug flags are not left enabled in the codebase, helping to maintain cleaner and more secure output generation during testing or production runs.
cops · high confidence
New scripts for font subsetting, reference generation, and dependency switching
Added several new scripts to the \scripts\ directory: \subset-fonts.sh\ and \subset-fonts.pe\ automate the subsetting of Noto, M+, and emoji fonts using FontForge (run via Podman or Docker); \generate-arrange-block-reference-files.sh\ creates reproducible PDF reference files for arrange-block tests; \decode-pdf-string\ is a Ruby utility for debugging PDF string encoding; and \switch-to-asciidoctor-head.rb\ and \switch-to-prawn-head.rb\ allow developers to hot-patch installed gems to use upstream development versions for testing.
scripts · high confidence
Removals
Removal of legacy Prawn-based PDF rendering components
The \lib/asciidoctor/prawn\ directory has been removed, deleting the \CodeRayEncoder\, \Extensions\, and \FormattedText\ modules. This eliminates the legacy Prawn-based PDF generation path, including its custom syntax highlighting, font handling, and text formatting logic, in favor of the current Asciidoctor PDF implementation.
lib/asciidoctor/prawn · high confidence
Architecture
Modularized build and release tasks into dedicated Rake files
The monolithic build and release logic has been split into individual, modular Rake task files (bundler, clean, console, postversion, release-line, release-notes, rspec, rubocop, version, and yard). This change improves maintainability by isolating specific responsibilities—such as version bumping, changelog generation, linting, and test execution—into their own dedicated files, making it easier to manage and extend the build process.
tasks · high confidence
Behavioural changes
Asciidoctor PDF restructured with new entry point and removed legacy theme loader
The Asciidoctor PDF library has been reorganized to improve modularity and compatibility. A new main entry point at lib/asciidoctor/pdf.rb now handles core dependencies (including Prawn and Asciidoctor) and autoloads standard libraries, replacing the previous structure. The legacy lib/asciidoctor/prawn.rb file and the custom lib/asciidoctor/theme\_loader.rb (which previously handled YAML-based theme loading with variable expansion) have been removed, indicating a shift in how themes and PDF generation extensions are managed within the converter architecture.
lib/asciidoctor · high confidence
Core library extensions for JRuby compatibility, PDF serialization, and output tracking
This change introduces several extensions to Ruby's core classes within the PDF converter. It adds a patch for JRuby to correctly handle absolute path detection and resolution, ensuring robust file path handling on Windows with non-ASCII characters. It also adds a \to\_pdf\_object\ method to \Object\ and \String\ classes to facilitate serialization of strings into PDF LiteralString objects, and introduces a \QuantifiableStdout\ class that wraps STDOUT to track the cumulative byte size of written content, enabling features like writing output to stdout.
lib/asciidoctor/pdf/ext/core · high confidence
Custom AsciiDoc and Text table cell implementations for improved layout control
The PDF renderer now uses custom Prawn table cell classes to handle AsciiDoc content and plain text with greater precision. The new AsciiDoc cell supports inheriting font properties from the table, handles horizontal alignment for paragraph-only cells, and correctly manages footnotes and image sizing within cells. The text cell override improves width calculations by accounting for inline images and hard line breaks, ensuring that table cells fit within their allocated space and preventing content overflow or unwanted page breaks.
lib/asciidoctor/pdf/ext/prawn-table/cell · high confidence
Enhanced SVG image loading with JPEG support and jail path validation
The Prawn::SVG loaders have been extended to support image/jpg MIME types in data URIs, allowing SVGs to reference base64-encoded JPEG images alongside existing PNG and SVG formats. Additionally, the file loader now validates that referenced image paths remain within the configured jail directory, preventing access to files outside the allowed scope, while the web loader has been refactored to support custom URI openers for remote image fetching.
lib/asciidoctor/pdf/ext/prawn-svg/loaders · high confidence
Enhanced document structure handling and data URI image support
The PDF converter now supports embedding images via data URIs, allowing inline SVG and raster images without external file references. It also improves document structure by promoting preface blocks to proper sections in books and correctly handling unset attributes for part and chapter signifiers. Additionally, new helper methods for navigating block siblings and list nesting levels simplify internal logic, while the \attr\_unspecified?\ method now accurately reflects attributes set or unset via the API or CLI.
lib/asciidoctor/pdf/ext/asciidoctor · high confidence
Enhanced table cell border rendering and CMYK color support
The Prawn table cell extension now supports transparent borders by rendering them with zero opacity, ensuring they do not visually obscure underlying content. It also fixes a crash when table border colors are specified using CMYK values by automatically duplicating the single CMYK color component to all four channels. Additionally, the module prepends a source location attribute to cells, enabling more precise debugging and warning messages for truncated content when the source map is enabled.
lib/asciidoctor/pdf/ext/prawn-table · high confidence
Enhanced text layout, font fallback, and styling in PDF rendering
The PDF text engine now supports more granular control over typography and layout. Users can apply a base color to formatted text blocks via the :color option, and text decoration colors and widths can be customized through themes. Subscript and superscript font sizes are now computed correctly when parent elements use em or percentage units, and relative sizes can be set independently. Line wrapping improvements include preserving soft hyphens when lines advance to the next page, supporting nowrap/nobreak roles, and allowing vertical alignment offsets for headers and footers. The font fallback mechanism is more robust, honoring font styles (bold/italic) when searching for glyphs and suppressing warnings for missing characters in inline images or line feeds. Additionally, the engine now supports indent\_paragraphs for formatted text boxes and protects bottom gutters in decorated blocks.
_lib/asciidoctor/pdf/ext/prawn/formatted\text · high confidence
Implement line highlighting and indentation preservation in Rouge source blocks
The Prawn formatter for Rouge syntax highlighting now supports line highlighting via the \highlight\_lines\ option, applying a background color to specified lines in source blocks. Additionally, indentation is preserved in source blocks even when line numbers are not enabled, and wrapped lines are indented beyond the line number gutter when line numbers are active. The formatter also handles missing glyphs by using a placeholder character to prevent layout issues and supports underline styles in Rouge themes.
lib/asciidoctor/pdf/ext/rouge/formatters · high confidence
Improved AFM font encoding handling and NULL character width enforcement
When rendering text with AFM fonts, characters that cannot be converted to the Windows-1252 encoding are now replaced with specific fallback symbols (such as replacing non-breaking spaces with regular spaces) and a warning is logged if the conversion fails, rather than raising an error. Additionally, the NULL character (code 0) is now explicitly forced to have a width of 0, even if it is missing from the font metrics, ensuring consistent layout behavior.
lib/asciidoctor/pdf/ext/prawn/font · high confidence
Improved column layout handling during page breaks and margin reflows
The PDF generator now better preserves multi-column layouts and indentation when content flows across pages, particularly in index sections or when using the :reflow\_margins option. This change ensures that column structures are correctly restored after page breaks, prevents crashes when margin reflow settings are absent, and maintains proper cursor positioning and padding consistency during document transitions.
lib/asciidoctor/pdf/ext/prawn/document · high confidence
PDF optimizer now supports color mode conversion and respects environment variables
The RGhost PDF optimizer now allows users to specify a color mode (such as grayscale or black-and-white) alongside the quality setting, enabling output conversion to gray or black-and-white PDFs. Additionally, the optimizer honors the GS\_OPTIONS environment variable to pass custom Ghostscript parameters and respects the GS environment variable to specify the Ghostscript executable path, while also patching Ruby 3.2 compatibility by aliasing File.exists?.
lib/asciidoctor/pdf/optimizer · high confidence
Refactor CLI entry points and introduce pluggable PDF optimizer
The \asciidoctor-pdf\ command now delegates to Asciidoctor's standard CLI infrastructure, enabling features like the \--theme\ shorthand and version printing, while the legacy \optimize-pdf\ shell script is replaced by a new Ruby-based \asciidoctor-pdf-optimize\ tool that uses a pluggable optimizer interface (defaulting to RGhost) for PDF optimization.
bin · high confidence
Removal of HTML-specific inline templates
The HTML-specific inline templates for anchors, footnotes, and quoted text have been removed from the data/templates directory. This change aligns with the project's shift to using Asciidoctor PDF as the primary converter, indicating that these HTML rendering rules are no longer maintained or required for the current output format.
data/templates · high confidence
Reorganized PDF extension library into modular require paths
The PDF generation extension library has been restructured to improve modularity and maintainability. The previous flat structure under lib/asciidoctor/pdf/ext has been replaced with a hierarchical organization where specific extensions (such as prawn-svg, prawn-table, prawn-icon, and syntax highlighters like pygments and rouge) are now loaded via dedicated entry-point files (e.g., lib/asciidoctor/pdf/ext/prawn-svg.rb) that in turn require their respective sub-modules (e.g., calculators, loaders, elements). This change simplifies the loading process for users and developers by providing clear entry points for each extension component, while also allowing for more granular control over which parts of the PDF generation engine are loaded. The core functionality remains the same, but the codebase is now better organized for future enhancements and easier to navigate.
lib/asciidoctor/pdf/ext · high confidence
Reorganized Prawn extensions and added CodeRay syntax highlighting support
The Prawn extension logic has been reorganized: the main renderer code was moved from lib/asciidoctor/pdf\_renderer.rb to lib/asciidoctor/pdf/ext/prawn/extensions.rb, and new files were added for CodeRay encoding (lib/asciidoctor/pdf/ext/prawn/coderay\_encoder.rb), font metric caching (lib/asciidoctor/pdf/ext/prawn/font\_metric\_cache.rb), and image handling (lib/asciidoctor/pdf/ext/prawn/images.rb). The CodeRay encoder now provides syntax-highlighted text for code blocks using the Manni theme colors, while the image module handles SVG fitting and caching, and the font metric cache includes a compatibility patch for older Prawn versions.
lib/asciidoctor/pdf/ext/prawn · high confidence
Reorganized formatted text processing into modular components
The formatted text rendering pipeline has been restructured into distinct, single-responsibility modules: a new Formatter orchestrates parsing and transformation, while specialized handlers manage inline image arrangement and rendering, text alignment, background/border drawing, and source block line wrapping. The underlying parser has been upgraded to support a broader set of HTML tags (including button, kbd, mark, and menu), handle void elements generically, and support decimal and hexadecimal character references, providing a more robust foundation for inline text styling and layout.
_lib/asciidoctor/pdf/formatted\text · high confidence
Reorganized source files under asciidoctor/pdf
The library's source files have been reorganized under the asciidoctor/pdf directory structure, with the main entry point lib/asciidoctor-pdf.rb updated to require the new location. This change also enables frozen string literals in the source code.
lib · high confidence
Support for raster images in SVG via prawn-gmagick
The SVG image rendering logic has been updated to delegate raster image handling to the prawn-gmagick library when it is available. This allows Asciidoctor PDF to correctly process SVGs containing raster image references that were previously unsupported, resolving issue \#2223.
lib/asciidoctor/pdf/ext/prawn-svg/elements · high confidence
Updated bundled fonts and added documentation
The bundled M+ monospace fonts have been upgraded to the TESTFLIGHT 63a release, and the Noto Serif and Noto Sans fonts have been regenerated from the 2016-10-22 Fedora RPM package. These font subsets now include expanded character coverage, such as Cyrillic, Greek, Vietnamese, and various mathematical and geometric symbols, along with specific glyphs like the non-breaking hyphen and ballot boxes. To ensure transparency, new ABOUT files have been added to document the source versions and specific processing steps (such as kerning table generation and instruction removal) applied to each font subset, and legacy FontAwesome icon mappings have been consolidated into a new YAML configuration file.
data/fonts · high confidence
Fixes
Add page state tracking and reset capabilities to PDF::Core::Page
The PDF::Core::Page class now includes methods to manage page content state, specifically \tare\_content\_stream\, \empty?\, \imported\, and \reset\_content\. These additions allow the PDF generator to detect when a page is empty, mark pages as imported to suppress running content, and reset page content streams, which helps prevent crashes when handling documents with cover pages and SVG backgrounds.
lib/asciidoctor/pdf/ext/pdf-core · high confidence
Test coverage
Added test fixtures for block arrangement and admonition theming; Expanded test coverage for PDF converter features and edge cases; Organize custom RSpec matchers into separate files; Test suite infrastructure reorganized into modular spec\_helper components.
Dependencies
Initial gemspec and Gemfile for Asciidoctor PDF
The project introduces its first gemspec and Gemfile, formally declaring runtime dependencies on Asciidoctor (\~\> 2.0), Prawn (\~\> 2.4.0), and related Prawn extensions (prawn-table, prawn-templates, prawn-svg, prawn-icon), alongside development dependencies for RSpec, RuboCop, and syntax highlighting tools like Rouge and CodeRay.
(dependencies) · high confidence
Upgrade prawn-svg to 0.38.x
The underlying SVG rendering library has been upgraded to version 0.38.x. This update ensures continued compatibility with modern Ruby versions (specifically addressing warnings with Ruby 3.3 and the base64 gem) and incorporates bug fixes from the prawn-svg project to improve the reliability and display of SVG images within generated PDFs.
(repo-wide) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 70.
Lenses
- Code Health 93
- Architecture 100
- Maturity 64
- Readiness 63
- Security 83
Changes since last survey
- 300 commits — 268 feature/other, 32 fixes
By area
- docs/modules — 106 commits
- (root) — 91 commits
- .github/workflows — 29 commits
- lib/asciidoctor — 16 commits
- data/fonts — 4 commits
- spec/converter_spec.rb — 4 commits
- spec/diagram_spec.rb — 4 commits
- spec/reference — 4 commits
- spec/spec_helper — 4 commits
- spec/image_spec.rb — 3 commits
- spec/optimizer_spec.rb — 3 commits
- spec/running_content_spec.rb — 3 commits
- spec/section_spec.rb — 3 commits
- .github/ISSUE_TEMPLATE — 2 commits
- spec/arrange_block_spec.rb — 2 commits
- spec/font_spec.rb — 2 commits
- spec/ignore-gem-warnings.rb — 2 commits
- spec/table_spec.rb — 2 commits
- spec/title_page_spec.rb — 2 commits
- spec/toc_spec.rb — 2 commits
Notable commits
- fix: Fix misspelling in CONTRIBUTING-CODE.adoc (PR #2530)
- fix: fix Asciidoctor Diagram version in release and upstream dispatch workflows [skip ci]
- fix: fix CI errors due to logger warning and outdated asciidoctor-diagram
- fix: fix Vimeo poster test due to video being removed
- fix: fix broken test due to helper change
- fix: fix callback in the not_log_message assertion so it reports the failure correctly
- fix: fix callout reference
- fix: fix check for macOS in test suite
- fix: fix check for version of Rouge; use latest Rouge release when testing primary
- fix: fix footnote about hyphenation
- fix: fix gem diff url in release script (again) [skip ci]
- fix: fix gem diff url in release script [skip ci]
- fix: fix include in docs
- fix: fix invalid variable reference in theme example
- fix: fix issue reference in CHANGELOG [skip ci]
- fix: fix link to API docs
- fix: fix lint error
- fix: fix lint error
- fix: fix lint error
- fix: fix lint errors
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
asciidoctor/asciidoctor-pdf was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 7ea543badd3677d6b6b860bc167f699bbe9a9d62 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.