diff --git a/CHANGELOG b/CHANGELOG
index 62b8063..3d37564 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
 unreleased
+- Preserve literal newlines in docstrings
 - Fix decompilation of complex infinity
 - Add support for Python 3.10 pattern matching
 - Fix incorrect decompilation of lambdas in comprehension guards on Python 3.9 and higher
diff --git a/ast_decompiler/decompiler.py b/ast_decompiler/decompiler.py
index d21c412..e642df8 100644
--- a/ast_decompiler/decompiler.py
+++ b/ast_decompiler/decompiler.py
@@ -834,13 +834,21 @@ class Decompiler(ast.NodeVisitor):
     def write_string(self, string_value: str, kind: Optional[str] = None) -> None:
         if kind is not None:
             self.write(kind)
+        if isinstance(self.get_parent_node(), ast.Expr) and '"""' not in string_value:
+            self.write('"""')
+            s = string_value.encode("unicode-escape").decode("ascii")
+            s = s.replace("\\n", "\n").replace("\\r", "\r")
+            self.write(s)
+            self.write('"""')
+            return
         if self.has_parent_of_type(ast.FormattedValue):
             delimiter = '"'
         else:
             delimiter = "'"
         self.write(delimiter)
         s = string_value.encode("unicode-escape").decode("ascii")
-        self.write(s.replace(delimiter, "\\" + delimiter))
+        s = s.replace(delimiter, "\\" + delimiter)
+        self.write(s)
         self.write(delimiter)
 
     def visit_FormattedValue(self, node: ast.FormattedValue) -> None:

diff --git a/tests/test_basic.py b/tests/test_basic.py
index 5b39dbc..72a8ecb 100644
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -1,6 +1,6 @@
 import ast
 from ast_decompiler import decompile
-from .tests import check, only_on_version
+from .tests import assert_decompiles, check, only_on_version
 
 
 def test_non_module() -> None:
@@ -380,6 +380,24 @@ def test_Str() -> None:
 b'foo'
 """
     )
+    check('"a\\nb"')
+    assert_decompiles(
+        '''def f():
+    """Doc.
+
+    String.
+
+    """
+''',
+        '''
+def f():
+    """Doc.
+
+    String.
+
+    """
+''',
+    )
 
 
 def test_Attribute() -> None:

Docstrings are not preserved correctly.
Currently it's impossible to correctly preserve docstrings. This test shows the issue:
```
from .tests import assert_decompiles


def test_docstrings():
    assert_decompiles('''
def a():
    """
    Docstring.
    """
    return 1
''', '''def a():
 """
 Docstring.
 """
 return 1
''', indentation=1)
```

Result:
```
>>> expected
def a():
 """
 Docstring.
 """
 return 1

>>> actual
def a():
 '\n    Docstring.\n    '
 return 1
```

Thoughts: when processing the function body in `write_function_def` we should look at the very first node in the function's body. If the node is of type Expr, and contains a string, then it's most likely docstring of this function and should be processed accordingly.
tests/test_basic.py::test_Str
tests/test_basic.py::test_non_module tests/test_basic.py::test_FunctionDef tests/test_basic.py::test_ClassDef tests/test_basic.py::test_Return tests/test_basic.py::test_Delete tests/test_basic.py::test_Assign tests/test_basic.py::test_AugAssign tests/test_basic.py::test_Print tests/test_basic.py::test_For tests/test_basic.py::test_While tests/test_basic.py::test_If tests/test_basic.py::test_With tests/test_basic.py::test_Raise tests/test_basic.py::test_Raise_old_syntax tests/test_basic.py::test_TryExcept tests/test_basic.py::test_TryFinally tests/test_basic.py::test_Assert tests/test_basic.py::test_Import tests/test_basic.py::test_ImportFrom tests/test_basic.py::test_Exec tests/test_basic.py::test_Global tests/test_basic.py::test_Expr tests/test_basic.py::test_Pass tests/test_basic.py::test_Break tests/test_basic.py::test_Continue tests/test_basic.py::test_BoolOp tests/test_basic.py::test_Binop tests/test_basic.py::test_UnaryOp tests/test_basic.py::test_Lambda tests/test_basic.py::test_IfExp tests/test_basic.py::test_Dict tests/test_basic.py::test_Set tests/test_basic.py::test_ListComp tests/test_basic.py::test_SetComp tests/test_basic.py::test_DictComp tests/test_basic.py::test_GeneratorExp tests/test_basic.py::test_Yield tests/test_basic.py::test_Yield_in_print tests/test_basic.py::test_Compare tests/test_basic.py::test_Call tests/test_basic.py::test_Repr tests/test_basic.py::test_Num tests/test_basic.py::test_longs tests/test_basic.py::test_Attribute tests/test_basic.py::test_Subscript tests/test_basic.py::test_Name tests/test_basic.py::test_List tests/test_basic.py::test_Tuple tests/test_basic.py::test_Slice tests/test_basic.py::test_ExtSlice tests/test_basic.py::test_Ellipsis tests/test_basic.py::test_files