Open rbauduin opened 5 months ago
Hello,
This worked for me:
Are you using a custom _template.html
maybe?
Thanks for having a look. I have the same behaviour when running in a docker container. There's some content that shouldn't be there. And it's no due to test containers, just running a simple task has the problem. Here's a Dockerfile reproducing the problem:
FROM mcr.microsoft.com/dotnet/sdk
RUN apt-get update && apt-get install -y python3
RUN dotnet tool install --global fsdocs-tool --version 19.1.1
RUN dotnet new console --language "F#" -n fsdocdemo
RUN cd fsdocdemo/
RUN mkdir docs
RUN cat >docs/minimal.fsx <<EOF
(**
# Usage
*)
(*** hide ***)
task {
return ()
}
|> Async.AwaitTask |> Async.RunSynchronously
EOF
RUN ~/.dotnet/tools/fsdocs build
WORKDIR output
CMD python3 -m http.server
Building the image and running it with this command:
image=$(docker build -q .) ; docker run --rm -it -p8000:8000 $image
I can access the result on http://localhost:8000/minimal.html and get this:
Could you try --version 20.0.0-beta-002
?
I tried with --version 20.0.0-beta-002
but also get additional content :-(
Some CSS seemed to be missing as layout was wrong.
Oh, I see what you are doing now.
You will need to provide a root for your scenario I believe.
The main problem is that it will not generate the proper links to the .js
and .css
files.
Try adding --parameters root ./
(Or maybe --parameters root /
even)
Adding the value for the root
parameter fixes it, thanks @nojaf !
After experimenting a bit, I see what I was doing 'wrong'. However, I don't understand the default value of the root parameter, which leads to paths like /$projectName/content/*.css
while it is actually generated at /$projectName/output/content/*.css
.
Not a big deal as it's working for me, just curious ;-)
Just for future readers, here's the fixed Dockerfile (including fixing the change of work directory). But note that in the end I went for a root parameter /
and running the http server inside the output
directory. Using /
as root parameter allows content generated in nested directories to also be styled correctly.
FROM mcr.microsoft.com/dotnet/sdk
RUN apt-get update && apt-get install -y python3
RUN dotnet tool install --global fsdocs-tool --version 20.0.0-beta-002
RUN dotnet new console --language "F#" -n fsdocsdemo
WORKDIR fsdocsdemo
RUN mkdir docs
RUN cat >docs/minimal.fsx <<EOF
(**
# Usage
*)
(*** hide ***)
#r "nuget: Testcontainers.PostgreSql, 3.6.0"
open Testcontainers.PostgreSql
task {
(** # Start container *)
let container =
(new PostgreSqlBuilder())
.WithImage("postgres:16")
.Build();
do! container.StartAsync()
printfn "%s" (container.GetConnectionString())
(** But let's not forget to stop it with *)
do! container.DisposeAsync().AsTask()
(*** hide ***)
}
|> Async.AwaitTask |> Async.RunSynchronously
EOF
RUN ~/.dotnet/tools/fsdocs build --parameters root ./
CMD python3 -m http.server
I agree that the default value is a bit weird here. We should document the root
parameter workaround.
Putting this fsx in the docs directory:
and then running![image](https://github.com/fsprojects/FSharp.Formatting/assets/9960888/3c4106a4-09a7-46aa-9afb-d4a77e293170)
fsdocs build
gives a page with content about test containers:It can be reproduced on linux with these commands:
and access http://localhost:8000/minimal.html
Some more information: