@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.
Files changed (75) hide show
  1. package/dist/{any-language-editor-QDDrgvfh.js → any-language-editor-DNmoSiWL.js} +18 -18
  2. package/dist/{chat-ui-BrKSZ7Yu.js → chat-ui-D6oraHT2.js} +11 -11
  3. package/dist/{code-visibility-CVmFerQM.js → code-visibility-CXkMXcdB.js} +5 -5
  4. package/dist/dist-7QfXoMdB.js +5 -0
  5. package/dist/{dist-DgnE8F-r.js → dist-A2846XWO.js} +1 -1
  6. package/dist/dist-BEXXyZig.js +5 -0
  7. package/dist/{dist-B3pZ0Ab6.js → dist-BR_gyG9L.js} +3 -3
  8. package/dist/{dist-CcXxepx6.js → dist-BSAt6RhH.js} +27 -27
  9. package/dist/{dist-Bde4a2kU.js → dist-BY018Paw.js} +8 -8
  10. package/dist/dist-BYj57OV4.js +5 -0
  11. package/dist/{dist-CUCNs1ja.js → dist-BaoDKvdy.js} +2 -2
  12. package/dist/{dist-Cy1WxgBD.js → dist-Bf7SHuNp.js} +5 -5
  13. package/dist/{dist-Bz_sYWbr.js → dist-Bk75fBZA.js} +2 -2
  14. package/dist/dist-BlSvQzNr.js +5 -0
  15. package/dist/{dist-C5VC_yzu.js → dist-BzEzfugY.js} +1 -1
  16. package/dist/dist-CCBlxAgS.js +8 -0
  17. package/dist/dist-CIDTVIUf.js +5 -0
  18. package/dist/{dist-CLUtPrdy.js → dist-CIYBwstr.js} +1 -1
  19. package/dist/{dist-BotSqB48.js → dist-C_Y3oV3C.js} +12 -12
  20. package/dist/{dist-BTfv03uy.js → dist-CcWX6tmx.js} +2 -2
  21. package/dist/{dist-BhM8gdSO.js → dist-CoXAujgg.js} +4 -4
  22. package/dist/{dist-4j4c7bjm.js → dist-CpxNdDkw.js} +3 -3
  23. package/dist/dist-CqQyhAM8.js +8 -0
  24. package/dist/dist-CwRu2Xzh.js +5 -0
  25. package/dist/{dist-BcuoonNH.js → dist-CxJDU6Bh.js} +9 -9
  26. package/dist/{dist-DxvORzUR.js → dist-D-W5ny5a.js} +8 -8
  27. package/dist/dist-D8CDTVgf.js +6 -0
  28. package/dist/dist-D8DNB0nO.js +8 -0
  29. package/dist/dist-DL6N_q-A.js +5 -0
  30. package/dist/{dist-BbbIBDiQ.js → dist-DMjWuVs8.js} +1 -1
  31. package/dist/dist-DOFbNV_b.js +8 -0
  32. package/dist/dist-DPrYzMY0.js +6 -0
  33. package/dist/{dist-h2c8sZvT.js → dist-DZORgqKY.js} +1 -1
  34. package/dist/{dist-B3P2fFpz.js → dist-DZo4nSS0.js} +14 -14
  35. package/dist/{dist-D4CewLk6.js → dist-Dax--nl9.js} +1 -1
  36. package/dist/{dist-DRfcqpxJ.js → dist-DgGbNavJ.js} +2 -2
  37. package/dist/{dist-fQ0ViXGs.js → dist-Dv_Y15yk.js} +107 -107
  38. package/dist/{dist-Bfwsv11D.js → dist-DyyjKEYf.js} +2 -2
  39. package/dist/{dist-p2qyWijU.js → dist-GZXUmt0b.js} +2 -2
  40. package/dist/{dist-CLJWPTX2.js → dist-LTU8Hdvn.js} +3 -3
  41. package/dist/{dist-DqAWR3CS.js → dist-M9Vag9Y0.js} +20 -20
  42. package/dist/{dist-DNdhYsgW.js → dist-U4F-tbMs.js} +79 -62
  43. package/dist/{dist-RqXTaiir.js → dist-abid3KgM.js} +11 -11
  44. package/dist/dist-cdmMjgsn.js +5 -0
  45. package/dist/dist-hT4QzYX-.js +1247 -0
  46. package/dist/{dist-luvabDEB.js → dist-t9Kf7xqC.js} +2 -2
  47. package/dist/esm-BaH2eg5-.js +1171 -0
  48. package/dist/{esm-Duie8iU-.js → esm-ga2Bf3O2.js} +43 -43
  49. package/dist/{extends-C3j0Pbh9.js → extends-D_hDsj6R.js} +1 -1
  50. package/dist/{html-to-image-D5fIgQg_.js → html-to-image-UEH5lFDZ.js} +2162 -2139
  51. package/dist/main.js +24 -24
  52. package/dist/{process-output-B59yoBQx.js → process-output-CyMLTogj.js} +1 -1
  53. package/dist/{reveal-component-bghJ00sb.js → reveal-component-dIolR_34.js} +8 -8
  54. package/dist/style.css +1 -1
  55. package/package.json +1 -1
  56. package/src/components/editor/documentation.css +19 -0
  57. package/src/core/codemirror/language/languages/python.ts +2 -0
  58. package/src/core/codemirror/lsp/__tests__/markdown-renderer.test.ts +41 -0
  59. package/src/core/codemirror/lsp/markdown-renderer.ts +59 -0
  60. package/dist/dist-0Fif7jnk.js +0 -5
  61. package/dist/dist-B5h_9sHB.js +0 -6
  62. package/dist/dist-B9M6R5ye.js +0 -5
  63. package/dist/dist-BCt3tnck.js +0 -8
  64. package/dist/dist-BUIJwMwn.js +0 -8
  65. package/dist/dist-BpquMd3k.js +0 -5
  66. package/dist/dist-BzJsqYfz.js +0 -5
  67. package/dist/dist-CA5ELXAf.js +0 -6
  68. package/dist/dist-CLBRs6Uv.js +0 -5
  69. package/dist/dist-CStVCMbq.js +0 -5
  70. package/dist/dist-CZRIEY3Y.js +0 -8
  71. package/dist/dist-CuUHbFD0.js +0 -5
  72. package/dist/dist-DV7Iabxb.js +0 -8
  73. package/dist/dist-DhHh0jLg.js +0 -1247
  74. package/dist/dist-DuEeHMvL.js +0 -5
  75. package/dist/esm-DzhtSSSq.js +0 -1171
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.10-dev24",
3
+ "version": "0.23.10-dev25",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -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("&lt;div&gt;");
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, "&amp;")
20
+ .replace(/</g, "&lt;")
21
+ .replace(/>/g, "&gt;");
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
+ }
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { i as pythonLanguage, n as localCompletionSource, r as python, t as globalCompletion } from "./dist-BotSqB48.js";
3
- export {
4
- python
5
- };
@@ -1,6 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import "./dist-DxvORzUR.js";
3
- import { n as sassCompletionSource, r as sassLanguage, t as sass } from "./dist-Bfwsv11D.js";
4
- export {
5
- sass
6
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { i as defineCSSCompletionSource, n as cssCompletionSource, r as cssLanguage, t as css } from "./dist-DxvORzUR.js";
3
- export {
4
- css
5
- };
@@ -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 { n as phpLanguage, t as php } from "./dist-Bde4a2kU.js";
6
- export {
7
- php
8
- };
@@ -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
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { n as jsonLanguage, t as json } from "./dist-h2c8sZvT.js";
3
- export {
4
- json
5
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { n as wastLanguage, t as wast } from "./dist-BbbIBDiQ.js";
3
- export {
4
- wast
5
- };
@@ -1,6 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import "./dist-DxvORzUR.js";
3
- import { n as lessCompletionSource, r as lessLanguage, t as less } from "./dist-luvabDEB.js";
4
- export {
5
- less
6
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { n as rustLanguage, t as rust } from "./dist-D4CewLk6.js";
3
- export {
4
- rust
5
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { n as cppLanguage, t as cpp } from "./dist-CLUtPrdy.js";
3
- export {
4
- cpp
5
- };
@@ -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
- };
@@ -1,5 +0,0 @@
1
- import "./dist-DNdhYsgW.js";
2
- import { n as javaLanguage, t as java } from "./dist-DgnE8F-r.js";
3
- export {
4
- java
5
- };
@@ -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 { n as vueLanguage, t as vue } from "./dist-CLJWPTX2.js";
6
- export {
7
- vue
8
- };