Skip to content

Instantly share code, notes, and snippets.

@nhirschey
Created November 22, 2023 09:27
Show Gist options
  • Save nhirschey/1424bea87f89f013d5ec88668170696d to your computer and use it in GitHub Desktop.
Save nhirschey/1424bea87f89f013d5ec88668170696d to your computer and use it in GitHub Desktop.
output from dotnet-repl not displaying
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"dotnet_repl_cellExecutionStartTime": "2023-11-22T09:25:48.0570832+00:00",
"dotnet_repl_cellExecutionEndTime": "2023-11-22T09:25:48.0798154+00:00"
},
"source": [
"---\n",
"category: Documentation\n",
"\n",
"categoryindex: 1\n",
"\n",
"index: 4\n",
"\n",
"---\n",
"\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",
"\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"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_repl_cellExecutionStartTime": "2023-11-22T09:25:48.081018+00:00",
"dotnet_repl_cellExecutionEndTime": "2023-11-22T09:25:50.1467326+00:00",
"dotnet_interactive": {
"language": "fsharp"
},
"polyglot_notebook": {
"kernelName": "fsharp"
}
},
"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"
}
],
"source": [
"type ContactCard =\n",
" { Name: string\n",
" Phone: string\n",
" ZipCode: string }\n",
"\n",
"// Create a new record\n",
"{ Name = \"Alf\"; Phone = \"(555) 555-5555\"; ZipCode = \"90210\" }"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (F#)",
"language": "F#",
"name": ".net-fsharp"
},
"language_info": {
"file_extension": ".fs",
"mimetype": "text/x-fsharp",
"name": "F#",
"pygments_lexer": "fsharp",
"version": "6.0"
},
"polyglot_notebook": {
"defaultKernelName": "fsharp",
"items": [
{
"name": "fsharp"
}
]
},
"dotnet_interactive": {
"defaultKernelName": "fsharp",
"items": [
{
"name": "fsharp"
}
]
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment