diff --git a/src/DiDom/Document.php b/src/DiDom/Document.php
index <HASH>..<HASH> 100644
--- a/src/DiDom/Document.php
+++ b/src/DiDom/Document.php
@@ -177,6 +177,17 @@ class Document
     }
 
     /**
+     * @param  bool $format
+     * @return $this
+     */
+    public function format($format = true)
+    {
+        $this->document->formatOutput = $format;
+        
+        return $this;
+    }
+
+    /**
      * Get the text content of this node and its descendants.
      * 
      * @return string
Added the ability to format HTML code of the document when outputting