Skip to content

Commit acdf616

Browse files
authored
Merge pull request #874 from nhirschey/ipynb-input
Ipynb input
2 parents 095678a + b2200b9 commit acdf616

File tree

22 files changed

+1055
-16
lines changed

22 files changed

+1055
-16
lines changed

.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"commands": [
1414
"fsharp-analyzers"
1515
]
16+
},
17+
"dotnet-repl": {
18+
"version": "0.1.208",
19+
"commands": [
20+
"dotnet-repl"
21+
]
1622
}
1723
}
1824
}

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
1919
<PackageVersion Include="Suave" Version="2.6.2" />
2020
<PackageVersion Include="System.Memory" Version="4.5.5" />
21+
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
2122
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
2223
<PackageVersion Include="NUnit" Version="3.14.0" />
2324
<PackageVersion Include="FsUnit" Version="5.6.0" />

RELEASE_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 20.0.0-alpha-014 - 2023-11-22
4+
5+
### Added
6+
* Added the ability to use ipynb files as inputs [#874](https://github.com/fsprojects/FSharp.Formatting/pull/874)
7+
8+
### Fixed
9+
* Fsx outputs no longer treat inline html as F# code. Inline html blocks are now enclosed inside literate comments.
10+
311
## 20.0.0-alpha-013 - 2023-11-21
412

513
### Added

docs/apidocs.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title: Generating API Docs
44
category: Documentation
55
categoryindex: 1
6-
index: 5
6+
index: 6
77
---
88
*)
99
(*** condition: prepare ***)

docs/content.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
category: Documentation
44
categoryindex: 1
5-
index: 3
5+
index: 5
66
---
77
*)
88
(*** condition: prepare ***)

docs/evaluation.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
category: Documentation
44
categoryindex: 1
5-
index: 6
5+
index: 7
66
---
77
*)
88
(*** condition: prepare ***)

docs/literate-notebook.ipynb

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"dotnet_repl_cellExecutionStartTime": "2023-11-22T13:28:54.243692+00:00",
7+
"dotnet_repl_cellExecutionEndTime": "2023-11-22T13:28:54.2640212+00:00"
8+
},
9+
"source": [
10+
"---\n",
11+
"category: Documentation\n",
12+
"\n",
13+
"categoryindex: 1\n",
14+
"\n",
15+
"index: 4\n",
16+
"\n",
17+
"---\n",
18+
"\n",
19+
"# Literate Notebooks\n",
20+
"\n",
21+
"Content may be created using [.NET interactive](https://github.com/dotnet/interactive/tree/main) polyglot notebooks as the input file. Notebooks are processed by converting the notebook to a literate `.fsx` script and then passing the script through the script processing pipeline. Markdown notebook cells are passed through as comments surrounded by `(**` and `*)`, F# code cells are passed through as code, and non-F# code is passed through as markdown fenced code blocks between `(**` and `*)` comment markers. \n",
22+
"\n",
23+
"The `fsdocs` tool uses [dotnet-repl](https://github.com/jonsequitur/dotnet-repl) to evaluate polyglot notebooks. You need this tool to evaluate notebooks using `dotnet fsdocs --eval`. It can be installed into your local tool manifest using the command `dotnet tool install dotnet-repl`.\n",
24+
"\n",
25+
"F# Formatting tries to faithfully reproduce a notebook's native appearance when generating documents. Notebook cell outputs are passed through unchanged to preserve the notebook's html output. The below snippet demonstrates a notebook's html output for F# records, which differs from the output you would get with the same code inside a literate scripts.\n"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": null,
31+
"metadata": {
32+
"dotnet_repl_cellExecutionStartTime": "2023-11-22T13:28:54.265034+00:00",
33+
"dotnet_repl_cellExecutionEndTime": "2023-11-22T13:28:56.2484876+00:00",
34+
"dotnet_interactive": {
35+
"language": "fsharp"
36+
},
37+
"polyglot_notebook": {
38+
"kernelName": "fsharp"
39+
}
40+
},
41+
"outputs": [
42+
{
43+
"data": {
44+
"text/html": [
45+
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>{ Name = &quot;Alf&quot;\\n Phone = &quot;(555) 555-5555&quot;\\n ZipCode = &quot;90210&quot; }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Name</td><td><div class=\"dni-plaintext\"><pre>&quot;Alf&quot;\r\n",
46+
"</pre></div></td></tr><tr><td>Phone</td><td><div class=\"dni-plaintext\"><pre>&quot;(555) 555-5555&quot;\r\n",
47+
"</pre></div></td></tr><tr><td>ZipCode</td><td><div class=\"dni-plaintext\"><pre>&quot;90210&quot;\r\n",
48+
"</pre></div></td></tr></tbody></table></div></details><style>\r\n",
49+
".dni-code-hint {\r\n",
50+
" font-style: italic;\r\n",
51+
" overflow: hidden;\r\n",
52+
" white-space: nowrap;\r\n",
53+
"}\r\n",
54+
".dni-treeview {\r\n",
55+
" white-space: nowrap;\r\n",
56+
"}\r\n",
57+
".dni-treeview td {\r\n",
58+
" vertical-align: top;\r\n",
59+
" text-align: start;\r\n",
60+
"}\r\n",
61+
"details.dni-treeview {\r\n",
62+
" padding-left: 1em;\r\n",
63+
"}\r\n",
64+
"table td {\r\n",
65+
" text-align: start;\r\n",
66+
"}\r\n",
67+
"table tr { \r\n",
68+
" vertical-align: top; \r\n",
69+
" margin: 0em 0px;\r\n",
70+
"}\r\n",
71+
"table tr td pre \r\n",
72+
"{ \r\n",
73+
" vertical-align: top !important; \r\n",
74+
" margin: 0em 0px !important;\r\n",
75+
"} \r\n",
76+
"table th {\r\n",
77+
" text-align: start;\r\n",
78+
"}\r\n",
79+
"</style>"
80+
]
81+
},
82+
"metadata": {},
83+
"output_type": "display_data"
84+
}
85+
],
86+
"source": [
87+
"type ContactCard =\n",
88+
" { Name: string\n",
89+
" Phone: string\n",
90+
" ZipCode: string }\n",
91+
"\n",
92+
"// Create a new record\n",
93+
"{ Name = \"Alf\"; Phone = \"(555) 555-5555\"; ZipCode = \"90210\" }"
94+
]
95+
}
96+
],
97+
"metadata": {
98+
"kernelspec": {
99+
"display_name": ".NET (F#)",
100+
"language": "F#",
101+
"name": ".net-fsharp"
102+
},
103+
"language_info": {
104+
"file_extension": ".fs",
105+
"mimetype": "text/x-fsharp",
106+
"name": "F#",
107+
"pygments_lexer": "fsharp",
108+
"version": "6.0"
109+
},
110+
"polyglot_notebook": {
111+
"defaultKernelName": "fsharp",
112+
"items": [
113+
{
114+
"name": "fsharp"
115+
}
116+
]
117+
},
118+
"dotnet_interactive": {
119+
"defaultKernelName": "fsharp",
120+
"items": [
121+
{
122+
"name": "fsharp"
123+
}
124+
]
125+
}
126+
},
127+
"nbformat": 4,
128+
"nbformat_minor": 5
129+
}

docs/styling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
category: Documentation
33
categoryindex: 1
4-
index: 7
4+
index: 8
55
---
66

77
# Customization and Styling

docs/users.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
category: Documentation
33
categoryindex: 1
4-
index: 8
4+
index: 9
55
---
66
# Users of FSharp.Formatting
77

docs/zero-to-hero.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
category: Documentation
33
categoryindex: 1
4-
index: 9
4+
index: 10
55
---
66
# From zero to hero: deploying to GitHub Pages
77

0 commit comments

Comments
 (0)