Method: Jazzy::Markdown::JazzyHTML#codespan

Defined in:
lib/jazzy/jazzy_markdown.rb

#codespan(text) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/jazzy/jazzy_markdown.rb', line 67

def codespan(text)
  case text
  when /^\$\$(.*)\$\$$/m
    o = ["</p><div class='math m-block'>",
         Regexp.last_match[1],
         '</div><p>']
    Markdown.has_math = true
  when /^\$(.*)\$$/m
    o = ["<span class='math m-inline'>", Regexp.last_match[1], '</span>']
    Markdown.has_math = true
  else
    o = ['<code>', text.to_s, '</code>']
  end

  o[0] + CGI.escapeHTML(o[1]) + o[2]
end