@marimo-team/islands 0.23.10-dev24 → 0.23.10-dev25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{any-language-editor-QDDrgvfh.js → any-language-editor-DNmoSiWL.js} +18 -18
- package/dist/{chat-ui-BrKSZ7Yu.js → chat-ui-D6oraHT2.js} +11 -11
- package/dist/{code-visibility-CVmFerQM.js → code-visibility-CXkMXcdB.js} +5 -5
- package/dist/dist-7QfXoMdB.js +5 -0
- package/dist/{dist-DgnE8F-r.js → dist-A2846XWO.js} +1 -1
- package/dist/dist-BEXXyZig.js +5 -0
- package/dist/{dist-B3pZ0Ab6.js → dist-BR_gyG9L.js} +3 -3
- package/dist/{dist-CcXxepx6.js → dist-BSAt6RhH.js} +27 -27
- package/dist/{dist-Bde4a2kU.js → dist-BY018Paw.js} +8 -8
- package/dist/dist-BYj57OV4.js +5 -0
- package/dist/{dist-CUCNs1ja.js → dist-BaoDKvdy.js} +2 -2
- package/dist/{dist-Cy1WxgBD.js → dist-Bf7SHuNp.js} +5 -5
- package/dist/{dist-Bz_sYWbr.js → dist-Bk75fBZA.js} +2 -2
- package/dist/dist-BlSvQzNr.js +5 -0
- package/dist/{dist-C5VC_yzu.js → dist-BzEzfugY.js} +1 -1
- package/dist/dist-CCBlxAgS.js +8 -0
- package/dist/dist-CIDTVIUf.js +5 -0
- package/dist/{dist-CLUtPrdy.js → dist-CIYBwstr.js} +1 -1
- package/dist/{dist-BotSqB48.js → dist-C_Y3oV3C.js} +12 -12
- package/dist/{dist-BTfv03uy.js → dist-CcWX6tmx.js} +2 -2
- package/dist/{dist-BhM8gdSO.js → dist-CoXAujgg.js} +4 -4
- package/dist/{dist-4j4c7bjm.js → dist-CpxNdDkw.js} +3 -3
- package/dist/dist-CqQyhAM8.js +8 -0
- package/dist/dist-CwRu2Xzh.js +5 -0
- package/dist/{dist-BcuoonNH.js → dist-CxJDU6Bh.js} +9 -9
- package/dist/{dist-DxvORzUR.js → dist-D-W5ny5a.js} +8 -8
- package/dist/dist-D8CDTVgf.js +6 -0
- package/dist/dist-D8DNB0nO.js +8 -0
- package/dist/dist-DL6N_q-A.js +5 -0
- package/dist/{dist-BbbIBDiQ.js → dist-DMjWuVs8.js} +1 -1
- package/dist/dist-DOFbNV_b.js +8 -0
- package/dist/dist-DPrYzMY0.js +6 -0
- package/dist/{dist-h2c8sZvT.js → dist-DZORgqKY.js} +1 -1
- package/dist/{dist-B3P2fFpz.js → dist-DZo4nSS0.js} +14 -14
- package/dist/{dist-D4CewLk6.js → dist-Dax--nl9.js} +1 -1
- package/dist/{dist-DRfcqpxJ.js → dist-DgGbNavJ.js} +2 -2
- package/dist/{dist-fQ0ViXGs.js → dist-Dv_Y15yk.js} +107 -107
- package/dist/{dist-Bfwsv11D.js → dist-DyyjKEYf.js} +2 -2
- package/dist/{dist-p2qyWijU.js → dist-GZXUmt0b.js} +2 -2
- package/dist/{dist-CLJWPTX2.js → dist-LTU8Hdvn.js} +3 -3
- package/dist/{dist-DqAWR3CS.js → dist-M9Vag9Y0.js} +20 -20
- package/dist/{dist-DNdhYsgW.js → dist-U4F-tbMs.js} +79 -62
- package/dist/{dist-RqXTaiir.js → dist-abid3KgM.js} +11 -11
- package/dist/dist-cdmMjgsn.js +5 -0
- package/dist/dist-hT4QzYX-.js +1247 -0
- package/dist/{dist-luvabDEB.js → dist-t9Kf7xqC.js} +2 -2
- package/dist/esm-BaH2eg5-.js +1171 -0
- package/dist/{esm-Duie8iU-.js → esm-ga2Bf3O2.js} +43 -43
- package/dist/{extends-C3j0Pbh9.js → extends-D_hDsj6R.js} +1 -1
- package/dist/{html-to-image-D5fIgQg_.js → html-to-image-UEH5lFDZ.js} +2162 -2139
- package/dist/main.js +24 -24
- package/dist/{process-output-B59yoBQx.js → process-output-CyMLTogj.js} +1 -1
- package/dist/{reveal-component-bghJ00sb.js → reveal-component-dIolR_34.js} +8 -8
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/editor/documentation.css +19 -0
- package/src/core/codemirror/language/languages/python.ts +2 -0
- package/src/core/codemirror/lsp/__tests__/markdown-renderer.test.ts +41 -0
- package/src/core/codemirror/lsp/markdown-renderer.ts +59 -0
- package/dist/dist-0Fif7jnk.js +0 -5
- package/dist/dist-B5h_9sHB.js +0 -6
- package/dist/dist-B9M6R5ye.js +0 -5
- package/dist/dist-BCt3tnck.js +0 -8
- package/dist/dist-BUIJwMwn.js +0 -8
- package/dist/dist-BpquMd3k.js +0 -5
- package/dist/dist-BzJsqYfz.js +0 -5
- package/dist/dist-CA5ELXAf.js +0 -6
- package/dist/dist-CLBRs6Uv.js +0 -5
- package/dist/dist-CStVCMbq.js +0 -5
- package/dist/dist-CZRIEY3Y.js +0 -8
- package/dist/dist-CuUHbFD0.js +0 -5
- package/dist/dist-DV7Iabxb.js +0 -8
- package/dist/dist-DhHh0jLg.js +0 -1247
- package/dist/dist-DuEeHMvL.js +0 -5
- package/dist/esm-DzhtSSSq.js +0 -1171
package/package.json
CHANGED
|
@@ -153,3 +153,22 @@
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
/* Syntax highlighting for LSP hover code blocks (lezer classHighlighter tok-* classes) */
|
|
158
|
+
.docs-documentation,
|
|
159
|
+
.cm-tooltip .documentation {
|
|
160
|
+
.tok-keyword { color: light-dark(#708, #c678dd); font-weight: 500; }
|
|
161
|
+
.tok-string,
|
|
162
|
+
.tok-string2 { color: light-dark(#a11, #98c379); }
|
|
163
|
+
.tok-number { color: light-dark(#164, #d19a66); }
|
|
164
|
+
.tok-bool,
|
|
165
|
+
.tok-atom { color: light-dark(#219, #d19a66); }
|
|
166
|
+
.tok-comment { color: var(--cm-comment); }
|
|
167
|
+
.tok-className { color: light-dark(#00f, #61afef); }
|
|
168
|
+
.tok-typeName,
|
|
169
|
+
.tok-namespace { color: light-dark(#085, #56b6c2); }
|
|
170
|
+
.tok-operator { color: light-dark(#a2f, #56b6c2); }
|
|
171
|
+
.tok-propertyName { color: light-dark(#05a, #e5c07b); }
|
|
172
|
+
.tok-variableName { color: light-dark(#000, #abb2bf); }
|
|
173
|
+
.tok-punctuation { color: light-dark(#000, #abb2bf); }
|
|
174
|
+
}
|
|
@@ -33,6 +33,7 @@ import { cellActionsState } from "../../cells/state";
|
|
|
33
33
|
import { pythonCompletionSource } from "../../completion/completer";
|
|
34
34
|
import type { PlaceholderType } from "../../config/types";
|
|
35
35
|
import { FederatedLanguageServerClient } from "../../lsp/federated-lsp";
|
|
36
|
+
import { createLspMarkdownRenderer } from "../../lsp/markdown-renderer";
|
|
36
37
|
import { NotebookLanguageServerClient } from "../../lsp/notebook-lsp";
|
|
37
38
|
import { createTransport } from "../../lsp/transports";
|
|
38
39
|
import { CellDocumentUri, type ILanguageServerClient } from "../../lsp/types";
|
|
@@ -342,6 +343,7 @@ export class PythonLanguageAdapter implements LanguageAdapter<{}> {
|
|
|
342
343
|
client: client as unknown as LanguageServerClient,
|
|
343
344
|
languageId: "python",
|
|
344
345
|
allowHTMLContent: true,
|
|
346
|
+
markdownRenderer: createLspMarkdownRenderer(),
|
|
345
347
|
useSnippetOnCompletion: true,
|
|
346
348
|
hoverConfig: hoverOptions,
|
|
347
349
|
completionConfig: autocompleteOptions,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { createLspMarkdownRenderer } from "../markdown-renderer";
|
|
4
|
+
|
|
5
|
+
describe("createLspMarkdownRenderer", () => {
|
|
6
|
+
it("syntax-highlights python code blocks with tok-* span classes", () => {
|
|
7
|
+
const render = createLspMarkdownRenderer();
|
|
8
|
+
const result = render("```python\ndef foo():\n pass\n```");
|
|
9
|
+
expect(result).toContain('class="language-python"');
|
|
10
|
+
expect(result).toContain("tok-keyword");
|
|
11
|
+
expect(result).toContain("<pre><code");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("does not highlight non-python code blocks", () => {
|
|
15
|
+
const render = createLspMarkdownRenderer();
|
|
16
|
+
const result = render("```bash\necho hello\n```");
|
|
17
|
+
expect(result).not.toContain("tok-keyword");
|
|
18
|
+
expect(result).toContain("<code");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders empty python code blocks as empty string", () => {
|
|
22
|
+
const render = createLspMarkdownRenderer();
|
|
23
|
+
const result = render("```python\n \n```");
|
|
24
|
+
expect(result).toBe("");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("renders markdown prose unchanged", () => {
|
|
28
|
+
const render = createLspMarkdownRenderer();
|
|
29
|
+
const result = render("## Examples\n\nSome text.");
|
|
30
|
+
expect(result).toContain("<h2");
|
|
31
|
+
expect(result).toContain("Examples");
|
|
32
|
+
expect(result).toContain("Some text.");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("escapes HTML in highlighted code", () => {
|
|
36
|
+
const render = createLspMarkdownRenderer();
|
|
37
|
+
const result = render('```python\nx = "<div>"\n```');
|
|
38
|
+
expect(result).not.toContain("<div>");
|
|
39
|
+
expect(result).toContain("<div>");
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { classHighlighter, highlightCode } from "@lezer/highlight";
|
|
3
|
+
import { parser as pythonParser } from "@lezer/python";
|
|
4
|
+
import { marked } from "marked";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Syntax-highlight a Python code string using the lezer Python parser.
|
|
8
|
+
* Returns an HTML string with tok-* span classes for styling.
|
|
9
|
+
*/
|
|
10
|
+
function highlightPython(code: string): string {
|
|
11
|
+
const tree = pythonParser.parse(code);
|
|
12
|
+
let html = "";
|
|
13
|
+
highlightCode(
|
|
14
|
+
code,
|
|
15
|
+
tree,
|
|
16
|
+
classHighlighter,
|
|
17
|
+
(text, classes) => {
|
|
18
|
+
const escaped = text
|
|
19
|
+
.replace(/&/g, "&")
|
|
20
|
+
.replace(/</g, "<")
|
|
21
|
+
.replace(/>/g, ">");
|
|
22
|
+
html += classes ? `<span class="${classes}">${escaped}</span>` : escaped;
|
|
23
|
+
},
|
|
24
|
+
() => {
|
|
25
|
+
html += "\n";
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
return html;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A markdown renderer for LSP hover tooltips that adds syntax highlighting
|
|
33
|
+
* to Python code blocks using the lezer Python parser and classHighlighter.
|
|
34
|
+
* The tok-* CSS classes are defined in documentation.css.
|
|
35
|
+
*/
|
|
36
|
+
export function createLspMarkdownRenderer(): (markdown: string) => string {
|
|
37
|
+
const renderer = new marked.Renderer();
|
|
38
|
+
const prevCode = renderer.code.bind(renderer);
|
|
39
|
+
|
|
40
|
+
renderer.code = (token) => {
|
|
41
|
+
const { text, lang } = token;
|
|
42
|
+
if (!text.trim()) {
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
if (lang === "python" || lang === "py") {
|
|
46
|
+
const highlighted = highlightPython(text);
|
|
47
|
+
return `<pre><code class="language-python">${highlighted}</code></pre>\n`;
|
|
48
|
+
}
|
|
49
|
+
return prevCode(token);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (markdown: string): string =>
|
|
53
|
+
marked(markdown, {
|
|
54
|
+
async: false,
|
|
55
|
+
gfm: true,
|
|
56
|
+
breaks: true,
|
|
57
|
+
renderer,
|
|
58
|
+
}) as string;
|
|
59
|
+
}
|
package/dist/dist-0Fif7jnk.js
DELETED
package/dist/dist-B5h_9sHB.js
DELETED
package/dist/dist-B9M6R5ye.js
DELETED
package/dist/dist-BCt3tnck.js
DELETED
package/dist/dist-BUIJwMwn.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./dist-DNdhYsgW.js";
|
|
2
|
-
import "./dist-CcXxepx6.js";
|
|
3
|
-
import "./dist-DxvORzUR.js";
|
|
4
|
-
import "./dist-DqAWR3CS.js";
|
|
5
|
-
import { i as liquidLanguage, n as liquid, r as liquidCompletionSource, t as closePercentBrace } from "./dist-4j4c7bjm.js";
|
|
6
|
-
export {
|
|
7
|
-
liquid
|
|
8
|
-
};
|
package/dist/dist-BpquMd3k.js
DELETED
package/dist/dist-BzJsqYfz.js
DELETED
package/dist/dist-CA5ELXAf.js
DELETED
package/dist/dist-CLBRs6Uv.js
DELETED
package/dist/dist-CStVCMbq.js
DELETED
package/dist/dist-CZRIEY3Y.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./dist-DNdhYsgW.js";
|
|
2
|
-
import "./dist-CcXxepx6.js";
|
|
3
|
-
import "./dist-DxvORzUR.js";
|
|
4
|
-
import "./dist-DqAWR3CS.js";
|
|
5
|
-
import { i as jinjaLanguage, n as jinja, r as jinjaCompletionSource, t as closePercentBrace } from "./dist-B3pZ0Ab6.js";
|
|
6
|
-
export {
|
|
7
|
-
jinja
|
|
8
|
-
};
|
package/dist/dist-CuUHbFD0.js
DELETED