FSharp.Formatting
FSharp.Formatting copied to clipboard
Template keywords are not always replaced
Background
Hi, I'm trying to understand how and where keyword replacements work. I don't know if "keyword" is the correct name for this feature.
The following
(**
Testing {{fsdocs-package-version}}
#r "nuget: DiffSharp-cpu, {{fsdocs-package-version}}"
{{fsdocs-package-version}}
"{{fsdocs-package-version}}"
dotnet new console -lang "F#" -o src/app
cd src/app
dotnet add package DiffSharp-cpu --version {{fsdocs-package-version}}
dotnet run
*)
// {{fsdocs-package-version}}
let a = "{{fsdocs-package-version}}"
{{fsdocs-package-version}}
renders this in my system
where {{fsdocs-package-version}} is not always replaced with its value. It looks like it's replaced in places where it's within string quotes, in code comments, and in the main html text. But I was expecting {{fsdocs-package-version}} to be replaced everywhere within the file, wherever it occurs.
Specific issue
One use case I need, which currently doesn't work, is this:
dotnet add package DiffSharp-cpu --version {{fsdocs-package-version}}
which doesn't work (see screenshot above). I need the output to be
dotnet add package DiffSharp-cpu --version 1.0.0-local-210421
Hmm yes, I'm a little but surprised it's doing some but not all.
The substitution code is here for markdown output: https://github.com/fsprojects/FSharp.Formatting/blob/b667a4bfb682760d8b9023ef261f3217a01fb6ce/src/FSharp.Formatting.Markdown/MarkdownUtils.fs#L242 and that is called for IPYNB here: https://github.com/fsprojects/FSharp.Formatting/blob/master/src/FSharp.Formatting.Markdown/PynbFormatting.fs#L37
I couldn't spot a mistake on first glance, we'll have to debug through it to see exactly which markdown structure is produced for the above.