Skip to content

Commit

Permalink
document ipynb -> fsx conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nhirschey committed Nov 22, 2023
1 parent c740c3b commit d4fe9fd
Showing 1 changed file with 21 additions and 60 deletions.
81 changes: 21 additions & 60 deletions docs/literate-notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"cells": [
{
"cell_type": "markdown",
"id": "9e399156",
"metadata": {
"dotnet_repl_cellExecutionStartTime": "2023-11-17T21:04:27.922626+00:00",
"dotnet_repl_cellExecutionEndTime": "2023-11-17T21:04:27.9559602+00:00"
"dotnet_repl_cellExecutionEndTime": "2023-11-22T12:20:24.6149643+00:00",
"dotnet_repl_cellExecutionStartTime": "2023-11-22T12:20:24.5700648+00:00"
},
"source": [
"---\n",
Expand All @@ -18,71 +19,31 @@
"\n",
"# Literate Notebooks\n",
"\n",
"It is possible create content using [.NET interactive](https://github.com/dotnet/interactive/tree/main) polyglot notebooks as the input file. The notebooks are processed by converting the notebook to markdown and then passing the markdown through the markdown processing pipeline.\n",
"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",
"\n",
"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",
"\n",
"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 literate scripts.\n"
"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"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4381f259",
"metadata": {
"dotnet_repl_cellExecutionStartTime": "2023-11-17T21:04:27.9577608+00:00",
"dotnet_repl_cellExecutionEndTime": "2023-11-17T21:04:30.3608545+00:00",
"dotnet_interactive": {
"language": "fsharp"
},
"dotnet_repl_cellExecutionEndTime": "2023-11-22T12:20:27.5439764+00:00",
"dotnet_repl_cellExecutionStartTime": "2023-11-22T12:20:24.6182652+00:00",
"polyglot_notebook": {
"kernelName": "fsharp"
},
"vscode": {
"languageId": "polyglot-notebook"
}
},
"outputs": [
{
"data": {
"text/html": [
"<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",
"</pre></div></td></tr><tr><td>Phone</td><td><div class=\"dni-plaintext\"><pre>&quot;(555) 555-5555&quot;\r\n",
"</pre></div></td></tr><tr><td>ZipCode</td><td><div class=\"dni-plaintext\"><pre>&quot;90210&quot;\r\n",
"</pre></div></td></tr></tbody></table></div></details><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview {\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview td {\r\n",
" vertical-align: top;\r\n",
" text-align: start;\r\n",
"}\r\n",
"details.dni-treeview {\r\n",
" padding-left: 1em;\r\n",
"}\r\n",
"table td {\r\n",
" text-align: start;\r\n",
"}\r\n",
"table tr { \r\n",
" vertical-align: top; \r\n",
" margin: 0em 0px;\r\n",
"}\r\n",
"table tr td pre \r\n",
"{ \r\n",
" vertical-align: top !important; \r\n",
" margin: 0em 0px !important;\r\n",
"} \r\n",
"table th {\r\n",
" text-align: start;\r\n",
"}\r\n",
"</style>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"type ContactCard =\n",
" { Name: string\n",
Expand All @@ -95,6 +56,14 @@
}
],
"metadata": {
"dotnet_interactive": {
"defaultKernelName": "fsharp",
"items": [
{
"name": "fsharp"
}
]
},
"kernelspec": {
"display_name": ".NET (F#)",
"language": "F#",
Expand All @@ -114,16 +83,8 @@
"name": "fsharp"
}
]
},
"dotnet_interactive": {
"defaultKernelName": "fsharp",
"items": [
{
"name": "fsharp"
}
]
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}

0 comments on commit d4fe9fd

Please sign in to comment.