Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 4596e49

Browse files
committed
feat: externalize code block responses in serialized form
update notebooks to use externalized responses
1 parent c576516 commit 4596e49

File tree

20 files changed

+7110
-230
lines changed

20 files changed

+7110
-230
lines changed

packages/core/src/models/CommentaryResponse.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { Entity } from './entity'
18+
import { KResponse } from './command'
1819
import REPL from './repl'
1920

2021
export type CommentaryResponse = {
@@ -27,9 +28,12 @@ export type CommentaryResponse = {
2728
/** Source filepath */
2829
filepath?: string
2930

30-
/** Body of the Card. It will be passed through as the source <Markdown source="..." /> */
31+
/** Markdown source */
3132
children: string
3233

34+
/** CodeBlock responses */
35+
codeBlockResponses?: { status: 'done' | 'error'; response: KResponse }[]
36+
3337
/** Prefix for image URLs */
3438
baseUrl?: string
3539

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"status": "done",
4+
"response": {
5+
"apiVersion": "kui-shell/v1",
6+
"kind": "XtermResponse",
7+
"rows": [[{ "innerText": "hello", "classList": [], "style": {}, "textContent": "h" }]],
8+
"code": 0
9+
}
10+
},
11+
{
12+
"status": "done",
13+
"response": {
14+
"apiVersion": "kui-shell/v1",
15+
"kind": "XtermResponse",
16+
"rows": [[{ "innerText": "world", "classList": [], "style": {}, "textContent": "w" }]],
17+
"code": 0
18+
}
19+
}
20+
]

plugins/plugin-client-common/notebooks/make-notebook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,13 @@ between tabs.
100100
To make a code block executable, make sure to specify a language of
101101
either `bash`, `sh`, or `shell`.
102102

103-
Inside a code blocks, you may define metadata:
103+
Inside a code blocks, you may define metadata, such as an identifier
104+
when linking code blocks into [Progress Step
105+
Lists](#progress-step-lists).
104106

105107
```bashy
106108
---
107109
id: my-first-command
108-
response: hello
109110
---
110111
echo hello
111112
```
@@ -122,7 +123,6 @@ repeated as a normal code block:
122123
```bash
123124
---
124125
id: my-first-command
125-
response: hello
126126
---
127127
echo hello
128128
```

0 commit comments

Comments
 (0)