Sha256: 46db72718cd9303482642926be55d80f19b7d46c806de41bebb3391b6d3f628b
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
#!/usr/bin/env ruby -s # Converts the contents of the given file to Confluence syntax (or stdin) and prints the result to stdout. # # Automatically enables all the additional features provided by Redcarpet. Provide flags to disable features. # # Usage: md2conf [-noautolink] [-nofencedcode] [-intraemphasis] [-nostrikethrough] [-nosuperscript] [-notables] FILENAME # md2conf -h require 'redcarpet/confluence' # == Helpers def usage "Usage: #{$0} [-noautolink] [-nofencedcode] [-intraemphasis] [-nostrikethrough] [-nosuperscript] [-notables] FILENAME" end def markdown_text if ARGV[0] File.read(ARGV[0]) else $stdin.read end end # == Script if $h $stderr.puts usage exit 0 end markdown_options = { autolink: $noautolink.nil?, fenced_code_blocks: $nofencedcode.nil?, no_intra_emphasis: $intraemphasis.nil?, strikethrough: $nostrikethrough.nil?, superscript: $nosuperscript.nil?, tables: $notables.nil? } renderer = Redcarpet::Markdown.new(Redcarpet::Confluence, markdown_options) $stdout.puts renderer.render(markdown_text)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redcarpet-confluence-1.1.0 | bin/md2conf |
redcarpet-confluence-1.0.1 | bin/md2conf |
redcarpet-confluence-1.0.0 | bin/md2conf |