code: def rst_add_mathjax(content):
      
  
      # .rst is the only valid extension for reStructuredText files
      _, ext = os.path.splitext(os.path.basename(content.source_path))
      if ext != '.rst':
          return
  
      # If math class is present in text, add the javascript
      # note that RST hardwires mathjax to be class "math"
      if 'class="math"' in content._content:
          content._content += "<script type='text/javascript'>%s</script>" % rst_add_mathjax.mathjax_script
docs: Adds mathjax script for reStructuredText