Module: Md2conf
- Defined in:
- lib/md2conf.rb,
lib/md2conf/version.rb
Overview
Processes markdown and converts it to Confluence Storage Format.
The main workload is done by redcarpet gem, which generates an almost ready-to-use XHTML output. But there’s some more magic performed by ConfluenceUtil class afterwards.
Defined Under Namespace
Classes: ConfluenceUtil
Constant Summary collapse
- VERSION =
'0.2.3'.freeze
Class Method Summary collapse
-
.parse_markdown(markdown, cut_header: true, max_toc_level: 7, config_file: '~/.md2conf.yaml') ⇒ String
Confluence Storage Format document.
Class Method Details
.parse_markdown(markdown, cut_header: true, max_toc_level: 7, config_file: '~/.md2conf.yaml') ⇒ String
Returns Confluence Storage Format document.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/md2conf.rb', line 191 def self.parse_markdown(markdown, cut_header: true, max_toc_level: 7, config_file: '~/.md2conf.yaml') if cut_header && markdown.start_with?('# ') markdown = markdown.lines.drop(1).join end = { tables: true, fenced_code_blocks: true, autolink: true, strikethrough: true, } md = Redcarpet::Markdown.new(Redcarpet::Render::XHTML.new, ) html = md.render(markdown) confluence = ConfluenceUtil.new(html, max_toc_level, config_file) confluence.parse end |