lib/markdown_converter.rb
def fill_column(str, max_width, position, padding)
    return str if max_width >= str_mb_width(str)

    i = 0; width = 0
    begin
      width += char_mb_width(str[i])
    end while width <= max_width && i += 1

    i += 1 while character_not_to_allow_newline_in_word?(str[i])

    if str.length > i + 1
      x = str[0..(i-1)] + "\n"
      xs = "#{padding * position}" + str[i..(str.length-1)]
      return x + fill_column(xs, max_width, position, padding)
    else
      return str
    end
  end
# str       : String, not including newline
# max_width : Max width in one line
# positon   : Position of beginning of line after second line
# padding   : Character used padding
str       : String, not including newline
max_width : Max width in one line
positon   : Position of beginning of line after second line
padding   : Character used padding
str : String not including newline max_width : Max width in one line positon : Position of beginning of line after second line padding : Character used padding
def fill_column(str, max_width, position, padding)
    return str if max_width >= str_mb_width(str)
    i = 0; width = 0
    begin
      width += char_mb_width(str[i])
    end while width <= max_width && i += 1
    i += 1 while character_not_to_allow_newline_in_word?(str[i])
    if str.length > i + 1
      x = str[0..(i-1)] + "\n"
      xs = "#{padding * position}" + str[i..(str.length-1)]
      return x + fill_column(xs, max_width, position, padding)
    else
      return str
    end
  end
def fill_column ( str , max_width , position , padding ) return str if max_width >= str_mb_width ( str ) i = 0 ; width = 0 begin width += char_mb_width ( str [ i ] ) end while width <= max_width && i += 1 i += 1 while character_not_to_allow_newline_in_word? ( str [ i ] ) if str . length > i + 1 x = str [ 0 .. ( i - 1 ) ] + "\n" xs = "#{padding * position}" + str [ i .. ( str . length - 1 ) ] return x + fill_column ( xs , max_width , position , padding ) else return str end end
str       : String, not including newline
max_width : Max width in one line
positon   : Position of beginning of line after second line
padding   : Character used padding
str : String not including newline max_width : Max width in one line positon : Position of beginning of line after second line padding : Character used padding
str
max_width
position
padding