FSharp.Formatting icon indicating copy to clipboard operation
FSharp.Formatting copied to clipboard

#if HTML does not work.

Open nhirschey opened this issue 4 years ago • 1 comments

I was trying to add content to HTML output that I do not want in IPYNB and FSX output. #if HTML is not working. See example below. I might be able to fix this with a pull request, but for now I am posting references to the code that probably needs changing.

The problem seems to be that

  • #if is handled in this function https://github.com/fsprojects/FSharp.Formatting/blob/49ee266b0d5c2cb3baa468add69b4439a39dea6f/src/FSharp.Formatting.Markdown/MarkdownUtils.fs#L155
  • This function is then used to generate ipynb and fsx output in their respective formatParagraphs such as here https://github.com/fsprojects/FSharp.Formatting/blob/49ee266b0d5c2cb3baa468add69b4439a39dea6f/src/FSharp.Formatting.Markdown/FsxFormatting.fs#L20
  • However, the HTML and Latex formatters do not use this function in their formatParagraphs.

Example illustrating failure:

#if HTML

printfn "Hello world"

#endif // HTML

(*** include-fsi-output ***)

image

nhirschey avatar Jul 29 '21 15:07 nhirschey

This one is annoyingly hard to fix because code sections are formatted to HTML earlier than for other outputs, I'm not sure why

dsyme avatar Nov 11 '21 01:11 dsyme