diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 85c53a6a6..aab352f09 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,6 @@
+## 15.0.2
+* Trim the `--fscoptions` before passing them as `otherflags`. ([comment #616](https://github.com/fsprojects/FSharp.Formatting/issues/616#issuecomment-1200877765))
+
## 15.0.1
* fix https://github.com/fsprojects/FSharp.Formatting/issues/749
diff --git a/docs/apidocs.fsx b/docs/apidocs.fsx
index f1efa60cd..94e1e50ed 100644
--- a/docs/apidocs.fsx
+++ b/docs/apidocs.fsx
@@ -251,14 +251,14 @@ Example as last line:
/// [omit]
module Bar =
let a = 42
-
+
(**
Example as first line:
*)
/// [omit]
/// Some actual comment
-module Bar` =
+module Bar2 =
let a = 42
(**
diff --git a/docs/commandline.md b/docs/commandline.md
index e6afcb7a3..12d610954 100644
--- a/docs/commandline.md
+++ b/docs/commandline.md
@@ -21,23 +21,24 @@ rules of [API doc generation](apidocs.html). The input accepted is described in
The command line options accepted are:
-| Command Line Option | Description |
-|:-----------------------|:-----------------------------------------|
-| `--input` | Input directory of content (default: `docs`) |
-| `--projects` | Project files to build API docs for outputs, defaults to all packable projects |
-| `--output` | Output Directory (default 'output' for 'build' and 'tmp/watch' for 'watch') |
-| `--noapidocs` | Disable generation of API docs |
-| `--eval` | Evaluate F# fragments in scripts |
-| `--saveimages` | Save images referenced in docs |
-| `--nolinenumbers` | Don't add line numbers, default is to add line number. |
-| `--parameters` | Additional substitution parameters for templates |
-| `--nonpublic` | The tool will also generate documentation for non-public members |
-| `--nodefaultcontent` | Do not copy default content styles, javascript or use default templates |
-| `--clean` | Clean the output directory |
-| `--help` | Display this help screen |
-| `--version` | Display version information |
-| `--properties` | Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 |
-| `--strict` | Fail if docs are missing or can't be generated |
+| Command Line Option | Description |
+|:---------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `--input` | Input directory of content (default: `docs`) |
+| `--projects` | Project files to build API docs for outputs, defaults to all packable projects |
+| `--output` | Output Directory (default 'output' for 'build' and 'tmp/watch' for 'watch') |
+| `--noapidocs` | Disable generation of API docs |
+| `--eval` | Evaluate F# fragments in scripts |
+| `--saveimages` | Save images referenced in docs |
+| `--nolinenumbers` | Don't add line numbers, default is to add line number. |
+| `--parameters` | Additional substitution parameters for templates |
+| `--nonpublic` | The tool will also generate documentation for non-public members |
+| `--nodefaultcontent` | Do not copy default content styles, javascript or use default templates |
+| `--clean` | Clean the output directory |
+| `--help` | Display this help screen |
+| `--version` | Display version information |
+| `--properties` | Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 |
+| `--fscoptions` | Additional arguments passed down as `otherflags` to the F# compiler when the API is being generated.
Note that these arguments are trimmed, this is to overcome [a limitation in the command line argument processing](https://github.com/commandlineparser/commandline/issues/58).
A typical use-case would be to pass an addition assembly reference.
Example `--fscoptions " -r:MyAssembly.dll"` |
+| `--strict` | Fail if docs are missing or can't be generated |
The following command line options are also accepted but it is instead recommended you use
settings in your .fsproj project files:
diff --git a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs
index 43c3ceb82..290572bb0 100644
--- a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs
+++ b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs
@@ -2985,7 +2985,7 @@ type ApiDocModel internal (substitutions, collection, entityInfos, root, qualify
// Default template file names
- let otherFlags = defaultArg otherFlags []
+ let otherFlags = defaultArg otherFlags [] |> List.map (fun (o: string) -> o.Trim())
let libDirs = defaultArg libDirs [] |> List.map Path.GetFullPath