resolves #4522 introduce stem block adapter#4702
Open
aw-engineer wants to merge 2 commits intoasciidoctor:mainfrom
Open
resolves #4522 introduce stem block adapter#4702aw-engineer wants to merge 2 commits intoasciidoctor:mainfrom
aw-engineer wants to merge 2 commits intoasciidoctor:mainfrom
Conversation
This was referenced Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Utilizes a plugin mechanism to convert stem blocks from markup to rendered output.
For example:
.classic behavior
.classic behavior
.newly supported behavior
Relationship Diagram
Design
Plugin implementation classes include the StemAdapter::PluginBase module. Following the "include and extend" pattern, PluginBase extends the plugin classes with supporting functionality such as 'register_for'. The plugin classes then register themselves for:
After registration, the Factory is able to instance a plugin based on those three parameters.
Parsing
This introduces new document attribute
:stem-renderer:(default: mathjax) to represent the format of the stem block after conversion. At time of writing, this is mathjax-compatible html, or mathml html.Conversion
Document conversion of a 'stem' block uses StemAdapter::Factory to instance an adapter plugin. Input format is defined implicitly (default: latexmath) or within the stem block. Output format is defined by document attribute
:stem-renderer:. If there is no plugin available, a stub plugin is provided to render a "this is not supported" message suitable for the backend.Implementation
Discrete plugins are located in stem_adapters/ directory. Support infrastructure is implemented in top-level stem_adapter.rb, and loads the plugins directly.
Testing
unit testing
command line
Discussion
:stem:may be ommitted -- it is implied by the content of document blocks[stem],[asciimath],[latexmath], etc..References
Programming Ruby 3.3 (5th Edition
Metaprogramming Ruby 2
#4522