I would recommend just extending CodeRay (the most Ruby friendly approach) in the normal way as described in CodeRay. Then, you just require your library (using -r in the asciidoctor command) and CodeRay should delegate to it. It's out of Asciidoctor's hands at that point. Asciidoctor is just invoking CodeRay and passing it the language.