nf-core schema docs output option does not work
### Description of the bug

`nf-core schema docs` has an output option (`-o`) which allows passing an output file to write the docs to. 

However the code for the docs command is as follows:

```py
if not output:
        stdout.print(schema_obj.print_documentation(output, format, force, columns.split(",")))
```

This means that if `-o` is supplied then docs are not generated at all, neither written to file or printed to `stdout`.



### Command used and terminal output

```console
nf-core schema docs -o docs/output.md -x markdown


                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\\
    |\\ | |__  __ /  ` /  \\ |__) |__         }  {
    | \\| |       \\__, \\__/ |  \\ |___     \\`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.7.2 - https://nf-co.re
```


### System information

nf-core/tools version 2.7.2
diff --git a/nf_core/__main__.py b/nf_core/__main__.py
index aaf0ea98..555783d8 100644
--- a/nf_core/__main__.py
+++ b/nf_core/__main__.py
@@ -1446,8 +1446,7 @@ def docs(schema_path, output, format, force, columns):
     # Assume we're in a pipeline dir root if schema path not set
     schema_obj.get_schema_path(schema_path)
     schema_obj.load_schema()
-    if not output:
-        stdout.print(schema_obj.print_documentation(output, format, force, columns.split(",")))
+    schema_obj.print_documentation(output, format, force, columns.split(","))
 
 
 # nf-core bump-version
diff --git a/nf_core/schema.py b/nf_core/schema.py
index a50a1ed7..b325a6a0 100644
--- a/nf_core/schema.py
+++ b/nf_core/schema.py
@@ -6,17 +6,20 @@ import copy
 import json
 import logging
 import os
+import tempfile
 import webbrowser
 
 import jinja2
 import jsonschema
 import markdown
+import rich.console
 import yaml
 from rich.prompt import Confirm
+from rich.syntax import Syntax
 
 import nf_core.list
 import nf_core.utils
-from nf_core.lint_utils import dump_json_with_prettier
+from nf_core.lint_utils import dump_json_with_prettier, run_prettier_on_file
 
 log = logging.getLogger(__name__)
 
@@ -464,13 +467,21 @@ class PipelineSchema:
         if format == "html":
             output = self.markdown_to_html(output)
 
-        # Print to file
-        if output_fn:
+        with tempfile.NamedTemporaryFile(mode="w+") as fh:
+            fh.write(output)
+            run_prettier_on_file(fh.name)
+            fh.seek(0)
+            prettified_docs = fh.read()
+
+        if not output_fn:
+            console = rich.console.Console()
+            console.print("\\n", Syntax(prettified_docs, format), "\\n")
+        else:
             if os.path.exists(output_fn) and not force:
                 log.error(f"File '{output_fn}' exists! Please delete first, or use '--force'")
                 return
-            with open(output_fn, "w") as file:
-                file.write(output)
+            with open(output_fn, "w") as fh:
+                fh.write(prettified_docs)
                 log.info(f"Documentation written to '{output_fn}'")
 
         # Return as a string
@@ -495,9 +506,11 @@ class PipelineSchema:
                     if column == "parameter":
                         out += f"| `{p_key}` "
                     elif column == "description":
-                        out += f"| {param.get('description', '')} "
+                        desc = param.get("description", "").replace("\\n", "<br>")
+                        out += f"| {desc} "
                         if param.get("help_text", "") != "":
-                            out += f"<details><summary>Help</summary><small>{param['help_text']}</small></details>"
+                            help_txt = param["help_text"].replace("\\n", "<br>")
+                            out += f"<details><summary>Help</summary><small>{help_txt}</small></details>"
                     elif column == "type":
                         out += f"| `{param.get('type', '')}` "
                     else:
['nf_core/schema.py', 'nf_core/__main__.py']