   """
   @spec empty() :: :doc_nil
   def empty, do: :doc_nil
+
+  @doc ~S"""
+  Creates a document represented by string.
+
+  While `Inspect.Algebra` accepts binaries as documents,
+  those are counted by binary size. On the other hand,
+  `string` documents are measured in terms of graphemes
+  towards the document size.
+
+  ## Examples
+
+  The following document has 10 bytes and therefore it
+  does not format to width 9 without breaks:
+
+      iex> doc = Inspect.Algebra.glue("olá", " ", "mundo")
+      iex> Inspect.Algebra.format(doc, 9)
+      ["olá", "\n", "mundo"]
+
+  However, if we use `string`, then the string length is
+  used, instead of byte size, correctly fitting:
+
+      iex> string = Inspect.Algebra.string("olá")
+      iex> doc = Inspect.Algebra.glue(string, " ", "mundo")
+      iex> Inspect.Algebra.format(doc, 9)
+      ["olá", " ", "mundo"]
+
+  """
+  @spec string(String.t) :: doc_string
+  def string(string) when is_binary(string) do
+    doc_string(string, String.length(string))
+  end
 
   @doc ~S"""
   Concatenates two document entities returning a new document.

  defp format(w, _, [{i, _, doc_line(_)} | t]),         do: [indent(i) | format(w, i, t)]
  defp format(w, k, [{i, m, doc_cons(x, y)} | t]),      do: format(w, k, [{i, m, x} | [{i, m, y} | t]])
  defp format(w, k, [{i, m, doc_color(x, c)} | t]),     do: [ansi(c) | format(w, k, [{i, m, x} | t])]
  defp format(w, k, [{_, _, s} | t]) when is_binary(s), do: [s | format(w, (k + byte_size(s)), t)]
  defp format(w, k, [{i, m, doc_next_fits(x)} | t]),    do: format(w, k, [{i, m, x} | t])

  # Flex breaks are not conditional to the mode

  defp fits?(w, k, [{i, m, doc_nest(x, _, :break)} | t]),  do: fits?(w, k, [{i, m, x} | t])
  defp fits?(w, k, [{i, m, doc_nest(x, j, _)} | t]),       do: fits?(w, k, [{apply_nesting(i, k, j), m, x} | t])
  defp fits?(w, k, [{i, _, doc_group(x)} | t]),            do: fits?(w, k, [{i, :flat, x} | t])
  defp fits?(w, k, [{_, _, doc_string(_, l)} | t]),        do: fits?(w, k + l, t)
  defp fits?(w, k, [{_, _, s} | t]) when is_binary(s),     do: fits?(w, k + byte_size(s), t)
  defp fits?(w, k, [{_, :flat, doc_break(s, _)} | t]),     do: fits?(w, k + byte_size(s), t)
  defp fits?(_, _, [{_, :break, doc_break(_, _)} | _]),    do: true
