Module: Mumukit::ContentType::Markdown
- Extended by:
- BaseContentType
- Defined in:
- lib/mumukit/content_type/markdown.rb
Defined Under Namespace
Classes: HTML
Constant Summary
collapse
- @@markdown =
Redcarpet::Markdown.new(HTML, autolink: true, fenced_code_blocks: true, no_intra_emphasis: true, tables: true)
Class Method Summary
collapse
format_exception, to_html
Class Method Details
.code(code) ⇒ Object
26
27
28
|
# File 'lib/mumukit/content_type/markdown.rb', line 26
def self.code(code)
"\n```\n#{code}\n```\n\n"
end
|
.highlighted_code(language, code) ⇒ Object
30
31
32
|
# File 'lib/mumukit/content_type/markdown.rb', line 30
def self.highlighted_code(language, code)
"```#{language}\n#{(code.ends_with? "\n") ? code : "#{code}\n"}```"
end
|
.htmlize(content) ⇒ Object
46
47
48
|
# File 'lib/mumukit/content_type/markdown.rb', line 46
def self.htmlize(content)
replace_mu_logo(content) if content
end
|
.inline_code(code) ⇒ Object
34
35
36
|
# File 'lib/mumukit/content_type/markdown.rb', line 34
def self.inline_code(code)
"`#{code}`"
end
|
.name ⇒ Object
50
51
52
|
# File 'lib/mumukit/content_type/markdown.rb', line 50
def self.name
'markdown'
end
|
.replace_mu_logo(content) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/mumukit/content_type/markdown.rb', line 38
def self.replace_mu_logo(content)
mumuki_logo = '<i class="text-primary da da-mumuki"></i>'
@@markdown
.render(content)
.gsub('<span class="err">ム</span>', mumuki_logo)
.gsub('ム', mumuki_logo)
end
|
.title(title) ⇒ Object
22
23
24
|
# File 'lib/mumukit/content_type/markdown.rb', line 22
def self.title(title)
"**#{title}**"
end
|