I'm not proficient enough in ruby to check this, but when imitating the algorithm here in javascript for https://gitlab.com/djencks/asciidoctor-mathjax.js, attributes not defined in the document header were not visible to the stem processing. Following a hint from Dan, I rewrote the search for stem content to visit the AST once, keeping track of the attribute values along the way. This produces the same behavior as the built-in stem processing. Adapting this to ruby should be easy for someone who can write this plugin :-)
I'm not proficient enough in ruby to check this, but when imitating the algorithm here in javascript for https://gitlab.com/djencks/asciidoctor-mathjax.js, attributes not defined in the document header were not visible to the stem processing. Following a hint from Dan, I rewrote the search for stem content to visit the AST once, keeping track of the attribute values along the way. This produces the same behavior as the built-in stem processing. Adapting this to ruby should be easy for someone who can write this plugin :-)