 
   ## Helpers
 
-  defp write(style, string, colors // IEx.Options.get(:colors)) do
+  defp write(style, string, colors) do
     color =  colors[style]
     enabled = colors[:enabled]
     seq_color = IO.ANSI.escape_fragment("%{#{color}}", enabled)

  @spaced [?_, ?*]

  # Clauses for handling spaces
  defp handle_inline(<<?*, ?*, ?\s, rest :: binary>>, nil, buffer, acc) do
    handle_inline(rest, nil, [?\s, ?*, ?*|buffer], acc)
  end

  defp handle_inline(<<mark, ?\s, rest :: binary>>, nil, buffer, acc) when mark in @spaced do
    handle_inline(rest, nil, [?\s, mark|buffer], acc)
  end

  defp handle_inline(<<?\s, ?*, ?*, rest :: binary>>, limit, buffer, acc) do
    handle_inline(rest, limit, [?*, ?*, ?\s|buffer], acc)
  end

  defp handle_inline(<<?\s, mark, rest :: binary>>, limit, buffer, acc) when mark in @spaced do
    handle_inline(rest, limit, [mark, ?\s|buffer], acc)
  end

  # Clauses for handling escape
  defp handle_inline(<<?\\, ?\\, rest :: binary>>, limit, buffer, acc) do
    handle_inline(rest, limit, [?\\|buffer], acc)
  end

  defp handle_inline(<<?\\, ?*, ?*, rest :: binary>>, limit, buffer, acc) do
    handle_inline(rest, limit, [?*, ?*|buffer], acc)
  end

  # A escape is not valid inside `
  defp handle_inline(<<?\\, mark, rest :: binary>>, limit, buffer, acc)
      when mark in [?_, ?*, ?`] and not(mark == limit and mark == ?`) do
    handle_inline(rest, limit, [mark|buffer], acc)
  end

  # Inline start
  defp handle_inline(<<?*, ?*, rest :: binary>>, nil, buffer, acc) when rest != "" do
    handle_inline(rest, ?d, ["**"], [Enum.reverse(buffer)|acc])
  end

  defp handle_inline(<<mark, rest :: binary>>, nil, buffer, acc) when rest != "" and mark in @single do
    handle_inline(rest, mark, [<<mark>>], [Enum.reverse(buffer)|acc])
  end

  # Inline end
  defp handle_inline(<<?*, ?*, rest :: binary>>, ?d, buffer, acc) do
    handle_inline(rest, nil, [], [inline_buffer(buffer)|acc])
  end

  defp handle_inline(<<mark, rest :: binary>>, mark, buffer, acc) when mark in @single do
    handle_inline(rest, nil, [], [inline_buffer(buffer)|acc])
  end

  defp handle_inline(<<char, rest :: binary>>, mark, buffer, acc) do
    handle_inline(rest, mark, [char|buffer], acc)
  end

  defp handle_inline(<<>>, _mark, buffer, acc) do
    iolist_to_binary Enum.reverse([Enum.reverse(buffer)|acc])
  end

  defp inline_buffer(buffer) do
    [h|t] = Enum.reverse([IO.ANSI.reset|buffer])
    [color_for(h)|t]
  end

  ## Text (paragraphs / lists)

  defp process_text(doc=["" | _], para, indent, from_list, colors) do
    write_text(Enum.reverse(para), indent, from_list, colors)
    process(doc, indent, colors)
  end

  defp process_text([], para, indent, from_list, colors) do
    write_text(Enum.reverse(para), indent, from_list, colors)
  end

  defp process_text([line | rest], para, indent, true, colors) do
    { stripped, count } = strip_spaces(line, 0)
    case stripped do
      <<bullet, ?\s, item :: binary>> when bullet in @bullets ->
        write_text(Enum.reverse(para), indent, true, colors)
        process_list(item, rest, count, indent, colors)
      _ ->
        process_text(rest, [line | para], indent, true, colors)
