docs: 更新文档

master
bicijinlian 2 years ago
parent 56e901f0d1
commit 2b84c445d5

@ -3,3 +3,8 @@
系统学习微软 `Polyglt Notebooks` 多语言笔记本。 系统学习微软 `Polyglt Notebooks` 多语言笔记本。
参考项目:
+ [.Net Interactive](https://github.com/dotnet/interactive)
+ [csharp-notebooks(已归档)](https://github.com/dotnet/csharp-notebooks)
+ b站有相关视频E文的较多

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@ -0,0 +1,180 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"多语言笔记常见问题\n",
"================"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"参考:[官方文档](https://github.com/dotnet/interactive/blob/main/docs/FAQ.md)\n",
"+ 定义和概念\n",
"+ 使用多语言笔记本\n",
"+ 故障与排除"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 定义和概念"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 什么是笔记本?"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 什么是Jupyter Notebook"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 什么是JupyterLab"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 什么是前端?"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 使用多语言笔记本"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 故障与排除"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"var names = new string[]{\"张三\",\"李四\",\"王五\"};"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [
{
"data": {
"text/plain": [
"hello from JavaScript!"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"using Microsoft.DotNet.Interactive;\n",
"using Microsoft.DotNet.Interactive.Commands;\n",
"\n",
"var javascriptCode = \"console.log('hello from JavaScript!')\";\n",
"\n",
"await Kernel.Root.SendAsync(new SubmitCode(javascriptCode, \"javascript\"));"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "polyglot-notebook"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"name": ".NET"
},
{
"aliases": [
"C#",
"c#"
],
"languageName": "C#",
"name": "csharp"
},
{
"aliases": [
"js"
],
"languageName": "JavaScript",
"name": "javascript"
},
{
"aliases": [],
"languageName": "KQL",
"name": "kql"
},
{
"aliases": [
"frontend"
],
"name": "vscode"
},
{
"aliases": [],
"name": "webview"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

@ -149,6 +149,47 @@
"let va = await interactive.csharp.getVariable('names');\n", "let va = await interactive.csharp.getVariable('names');\n",
"interactive.csharp" "interactive.csharp"
] ]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 使用用户输入\n",
"\n",
"在 VS Code 顶部,显示一个用户输入框,让用户手动输入内容后,程序单元格可以捕获用户输入内容做相关功能:如下图\n",
"![用户输入](./assets/images/UserInput.png)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [
{
"data": {
"text/plain": [
"99"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"using Microsoft.DotNet.Interactive;\n",
"\n",
"var input = await Kernel.GetInputAsync(\"请输入一个数字:\");\n",
"\n",
"input.Display();"
]
} }
], ],
"metadata": { "metadata": {

Loading…
Cancel
Save