Class: Yuzu::Translators::MarkdownTranslator
Instance Method Summary
collapse
Methods inherited from Translator
can_translate?, filetypes, identify_filetype, registry, translate, #translates?, translators
Instance Method Details
#extensions ⇒ Object
7
8
9
|
# File 'lib/yuzu/translators/markdown.rb', line 7
def extensions
%w(.md .mdown .mkd .markdown .markd)
end
|
#translate(contents) ⇒ Object
11
12
13
14
15
|
# File 'lib/yuzu/translators/markdown.rb', line 11
def translate(contents)
rendered = Kramdown::Document.new(contents).to_html
rendered = rendered.gsub("<p><noscript></p>", "<noscript>").gsub("<p></noscript></p>", "</noscript>")
rendered.gsub(/\n\s*<\/code>/, "</code>").gsub(/<code>(?!\s)/, "<code> ")
end
|