Class: Asciidoctor::Katex::Postprocessor

Inherits:
Extensions::Postprocessor
  • Object
show all
Defined in:
lib/asciidoctor/katex/postprocessor.rb

Overview

Asciidoctor processor that removes MathJax ‘script` tags, produced by the Asciidcotor’s built-in HTML converter, from the converted document.

Instance Method Summary collapse

Instance Method Details

#process(document, output) ⇒ String

Returns a modified output`.

Parameters:

  • document (Asciidoctor::Document)

    the document to process.

  • output (String)

    the converted document.

Returns:

  • (String)

    a modified output`.



13
14
15
16
17
18
19
# File 'lib/asciidoctor/katex/postprocessor.rb', line 13

def process(document, output)
  return output if skip? document

  output
    .sub(%r{<script type="text/x-mathjax-config">.*?</script>}m, '')  # FIXME: broken in JS
    .sub(%r{<script src=".*?/MathJax\.js\?config=TeX-MML-AM_HTMLorMML"></script>}, '')
end