Sha256: 8d57d9133958270b55d1f239b5a406891f4432c89c6bc7cbdea43e9a48227fa3
Contents?: true
Size: 468 Bytes
Versions: 1
Compression:
Stored size: 468 Bytes
Contents
module Inferno module Utils # @api private module MarkdownFormatter def format_markdown(markdown) # rubocop:disable Metrics/CyclomaticComplexity lines = markdown.lines return markdown if lines.any? { |line| line.match?(/^\S/) } natural_indent = lines.collect { |l| l.index(/[^ ]/) }.select { |l| !l.nil? && l.positive? }.min || 0 markdown.lines.map { |l| l[natural_indent..] || "\n" }.join end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inferno_core-0.0.6 | lib/inferno/utils/markdown_formatter.rb |