Skip to content

Commit

Permalink
try a fix for linux line endings test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nhirschey committed Nov 22, 2023
1 parent 4884263 commit 3db1fbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/FSharp.Formatting.Literate/ParsePynb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace FSharp.Formatting.Literate
open System.IO
open System.Text.Json
open FSharp.Formatting.Templating
open FSharp.Formatting.PynbModel

module internal ParsePynb =

Expand All @@ -17,7 +18,7 @@ module internal ParsePynb =
match this with
| Markdown source -> source
| Code code ->
let codeBlock = sprintf $"```{code.lang}\n{code.source}\n```"
let codeBlock = sprintf $"```{code.lang}\n{addLineEnd code.source}```"

match code.outputs with
| None -> codeBlock
Expand Down Expand Up @@ -142,7 +143,7 @@ module internal ParsePynb =

json.RootElement.GetProperty("cells").EnumerateArray()
|> Seq.map (parseCell >> (fun x -> x.ToMarkdown()))
|> String.concat "\n\n"
|> String.concat "\n"

let pynbToMarkdown ipynbFile =
ipynbFile |> File.ReadAllText |> pynbStringToMarkdown
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Literate.Tests/LiterateTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ let add a b = a + b
|> Literate.ToPynb
|> ParsePynb.pynbStringToMarkdown

mdOut |> shouldEqual mdIn
(mdOut.Trim()) |> shouldEqual (mdIn.Trim())

[<Test>]
let ``Script output is exactly right`` () =
Expand Down

0 comments on commit 3db1fbf

Please sign in to comment.