require 'asciidoctor/extensions' class NofollowProcessor < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :nofollow name_positional_attributes 'target', 'text' def process(parent, target, attrs) text = attrs['text'] || target (create_anchor parent, text, type: :link, target: target).tap |node| node.set_attr 'rel', 'nofollow' end end end Asciidoctor::Extensions.register do inline_macro NofollowProcessor end