@marimo-team/frontend 0.17.3 → 0.17.5
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/assets/{CellStatus-C3bK7-wN.js → CellStatus-DjUtGUqj.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-f8cXX1lE.js → ConnectedDataExplorerComponent-Bjfp6wiJ.js} +1 -1
- package/dist/assets/{ConsoleOutput-DWvKgTax.js → ConsoleOutput-C4nRvbNL.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-BgZFHyAp.js → MarimoErrorOutput-DKtP9DfP.js} +1 -1
- package/dist/assets/{Output-C8n2C1Pu.js → Output-x6LACtkd.js} +1 -1
- package/dist/assets/RenderHTML-B4Xlxz9Q.js +1 -0
- package/dist/assets/{add-cell-with-ai-Bwg9bH8i.js → add-cell-with-ai-D94Om7DS.js} +1 -1
- package/dist/assets/{add-database-form-dbmUeWp4.js → add-database-form-BDX2uZCC.js} +1 -1
- package/dist/assets/{add-missing-import-qki9bte9.js → add-missing-import-Cy6g_y6i.js} +1 -1
- package/dist/assets/{agent-panel-Dhy20Enr.js → agent-panel-DPCsTGPU.js} +1 -1
- package/dist/assets/{app-config-button-CYwoclvk.js → app-config-button-C02qSaV5.js} +1 -1
- package/dist/assets/{cell-actions-c22Lh_IO.js → cell-actions-CNcpitg7.js} +1 -1
- package/dist/assets/{cell-editor-GZrtvFJW.js → cell-editor-oXchtd-2.js} +1 -1
- package/dist/assets/{cell-link-sTcnY1Ng.js → cell-link-d9BMXpwm.js} +1 -1
- package/dist/assets/{cells-ChcCEAp9.js → cells-CZmitpcp.js} +3 -6
- package/dist/assets/{chat-components-2Txp_uWE.js → chat-components-u_00E1Iv.js} +1 -1
- package/dist/assets/{chat-panel-B-aSH1sh.js → chat-panel-BBQVqm6k.js} +1 -1
- package/dist/assets/{client-DphVxIGq.js → client-Co0Fvwib.js} +1 -1
- package/dist/assets/{column-preview-CXzpLY8T.js → column-preview-BsCKvnq_.js} +1 -1
- package/dist/assets/{command-palette-DisdRO5p.js → command-palette-C9_cNlJc.js} +1 -1
- package/dist/assets/{common-D0IIv-_3.js → common-BWlM0NQw.js} +1 -1
- package/dist/assets/{datasources-panel-6PT8Bek6.js → datasources-panel-CRS3I41j.js} +1 -1
- package/dist/assets/{dependency-graph-panel-6gaUZ9_z.js → dependency-graph-panel-PEDmfewV.js} +1 -1
- package/dist/assets/{documentation-panel-CuORNaIe.js → documentation-panel-Caz5K_OT.js} +1 -1
- package/dist/assets/{edit-page-CF6ZT6DW.js → edit-page-DuRQ1eIB.js} +3 -3
- package/dist/assets/{error-panel-DsYYzWCa.js → error-panel-D0ZJmprT.js} +1 -1
- package/dist/assets/{file-explorer-panel-CPZ1gNhJ.js → file-explorer-panel-Jnmw434H.js} +1 -1
- package/dist/assets/{floating-outline-BjOLeg9Q.js → floating-outline-BXSB3SQ6.js} +1 -1
- package/dist/assets/{focus-BrbV9nqw.js → focus-CUS3ckCE.js} +1 -1
- package/dist/assets/{form-BogImzlM.js → form-BlnK1x-p.js} +1 -1
- package/dist/assets/{form-wmMKGeHm.js → form-nAUuUhu3.js} +1 -1
- package/dist/assets/{home-page-XcjCdiYR.js → home-page-DIYkvTFf.js} +1 -1
- package/dist/assets/{index-B6c28rYm.css → index-BmcO-QYJ.css} +1 -1
- package/dist/assets/{index-BXJ0L2ZN.js → index-DsdBxblV.js} +6 -6
- package/dist/assets/{kiosk-mode-DW0KYuDo.js → kiosk-mode-CHVximkk.js} +1 -1
- package/dist/assets/{layout-CNCmZJQH.js → layout-CRXL9551.js} +1 -1
- package/dist/assets/{lazy-tfeVHpGH.js → lazy-ijSQmhmN.js} +2 -2
- package/dist/assets/{logs-panel-KRi5a3Yd.js → logs-panel-9HAqKVuS.js} +1 -1
- package/dist/assets/{mode-47luhzpx.js → mode-CtH3Xe58.js} +1 -1
- package/dist/assets/{name-cell-input-iv2D5yrk.js → name-cell-input-DZWpmHYT.js} +1 -1
- package/dist/assets/{outline-panel-CwQOW3hr.js → outline-panel-D0DvfWbQ.js} +1 -1
- package/dist/assets/{packages-panel-bIuFo_yZ.js → packages-panel-DmqfeORQ.js} +1 -1
- package/dist/assets/react-vega-CoPJaJAh.js +194 -0
- package/dist/assets/{react-vega-5InfQEZl.js → react-vega-D5EPmHUL.js} +1 -1
- package/dist/assets/{readonly-python-code-DOMir81o.js → readonly-python-code-Ba_IF_mK.js} +1 -1
- package/dist/assets/{run-page-DcyDyVAW.js → run-page-Dtlg4eqe.js} +1 -1
- package/dist/assets/{scratchpad-panel-6URLLQyW.js → scratchpad-panel-5EljtEkX.js} +1 -1
- package/dist/assets/{snippets-panel-DQjHx5dH.js → snippets-panel-Cg9ksbKX.js} +1 -1
- package/dist/assets/{state-Ds5BCDZt.js → state-7Nd5UYc6.js} +1 -1
- package/dist/assets/{state-OU5IKSGK.js → state-BDyZ5-wH.js} +1 -1
- package/dist/assets/{storage-CCZ0kBEN.js → storage-DczTxxXy.js} +1 -1
- package/dist/assets/{tracing-DlcXZDiG.js → tracing-CbAnhOdo.js} +1 -1
- package/dist/assets/{tracing-panel-BNZEX5NU.js → tracing-panel-B3iny2EN.js} +2 -2
- package/dist/assets/{types-XAhA2qP3.js → types-h5wz3HYN.js} +1 -1
- package/dist/assets/{useAddCell-CG6KWlO3.js → useAddCell-CWXmrhes.js} +1 -1
- package/dist/assets/{useCellActionButton-DFWFWfvs.js → useCellActionButton-fVEGFa_R.js} +1 -1
- package/dist/assets/{useDeleteCell-BPNrZc-g.js → useDeleteCell-Bg8Hgk6e.js} +1 -1
- package/dist/assets/{useNotebookActions-DhHVJ3q5.js → useNotebookActions-BurReKKo.js} +1 -1
- package/dist/assets/{useRunCells-BmIxLPpn.js → useRunCells-BiWuvMY1.js} +1 -1
- package/dist/assets/{useSplitCell-CDjHCs8K.js → useSplitCell-DhhZ7xVP.js} +1 -1
- package/dist/assets/{utilities.esm-B_umFSka.js → utilities.esm-CCw2KKJk.js} +1 -1
- package/dist/assets/{variable-panel-E1eImuWQ.js → variable-panel-Dkhq2h3W.js} +1 -1
- package/dist/assets/{vega-component-B7kKQDi7.js → vega-component-CrZQsWq8.js} +1 -1
- package/dist/index.html +25 -25
- package/package.json +2 -2
- package/src/core/codemirror/language/__tests__/markdown.test.ts +36 -13
- package/src/core/codemirror/language/__tests__/utils.test.ts +6 -2
- package/src/css/md.css +6 -0
- package/src/plugins/core/__test__/sanitize.test.ts +27 -0
- package/src/plugins/core/sanitize.ts +1 -1
- package/src/plugins/layout/TexPlugin.tsx +33 -5
- package/dist/assets/RenderHTML-DockW4fh.js +0 -1
- package/dist/assets/react-vega-Kdht4Pfp.js +0 -192
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-DsdBxblV.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-DImqtvgl.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DZLz74EQ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-BcIddLXZ.js">
|
|
@@ -138,12 +138,12 @@
|
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/type-DVCC-93H.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/marked.esm-BB_RKOA5.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/main-CCaZmKLi.js">
|
|
141
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
141
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-CZmitpcp.js">
|
|
142
142
|
<link rel="modulepreload" crossorigin href="./assets/kbd-BfBY_QKr.js">
|
|
143
143
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-a-3t8sis.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/useEvent-itkPNnCe.js">
|
|
145
|
-
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-
|
|
146
|
-
<link rel="modulepreload" crossorigin href="./assets/lazy-
|
|
145
|
+
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-Bg8Hgk6e.js">
|
|
146
|
+
<link rel="modulepreload" crossorigin href="./assets/lazy-ijSQmhmN.js">
|
|
147
147
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-DEWTIUVh.js">
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/precisionRound-BLxyDkD7.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-B9-NA0ur.js">
|
|
@@ -160,24 +160,24 @@
|
|
|
160
160
|
<link rel="modulepreload" crossorigin href="./assets/usePress-C2JVmCUi.js">
|
|
161
161
|
<link rel="modulepreload" crossorigin href="./assets/input-DuVApvWu.js">
|
|
162
162
|
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-ExH1h9et.js">
|
|
163
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
163
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-d9BMXpwm.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/alert-B5fh2kMN.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/links-90C38wV6.js">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
167
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/state-7Nd5UYc6.js">
|
|
167
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-DKtP9DfP.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/spinner-1oeuzoUk.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/_arrayReduce-DV4IVFuG.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/startCase-RfubwhHM.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/strings-DRRWXNT2.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/command-DhuV6_de.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/popover-BoRNi4dY.js">
|
|
174
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
174
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-BiWuvMY1.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/copy-SPzF4B1M.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/copy-CDDalEhv.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-Ckew1l1_.js">
|
|
178
|
-
<link rel="modulepreload" crossorigin href="./assets/mode-
|
|
178
|
+
<link rel="modulepreload" crossorigin href="./assets/mode-CtH3Xe58.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/purify.es-CmG1k0Cr.js">
|
|
180
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
180
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-B4Xlxz9Q.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/table-Bj1zHGNd.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/tabs-CGHt3Blh.js">
|
|
183
183
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-BPaRR7vx.js">
|
|
@@ -194,8 +194,8 @@
|
|
|
194
194
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CQ9jB95h.js">
|
|
195
195
|
<link rel="modulepreload" crossorigin href="./assets/range-ZclXTdAh.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="./assets/table-CmDieCGZ.js">
|
|
197
|
-
<link rel="modulepreload" crossorigin href="./assets/Output-
|
|
198
|
-
<link rel="modulepreload" crossorigin href="./assets/name-cell-input-
|
|
197
|
+
<link rel="modulepreload" crossorigin href="./assets/Output-x6LACtkd.js">
|
|
198
|
+
<link rel="modulepreload" crossorigin href="./assets/name-cell-input-DZWpmHYT.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/useHotkey-Ca6pS8sJ.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-CNyONSoo.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/esm-D8ZMWeYP.js">
|
|
@@ -298,18 +298,18 @@
|
|
|
298
298
|
<link rel="modulepreload" crossorigin href="./assets/z80-CJYC52xh.js">
|
|
299
299
|
<link rel="modulepreload" crossorigin href="./assets/esm-DXHMyc8g.js">
|
|
300
300
|
<link rel="modulepreload" crossorigin href="./assets/trash-DpmcvlCC.js">
|
|
301
|
-
<link rel="modulepreload" crossorigin href="./assets/ConsoleOutput-
|
|
301
|
+
<link rel="modulepreload" crossorigin href="./assets/ConsoleOutput-C4nRvbNL.js">
|
|
302
302
|
<link rel="modulepreload" crossorigin href="./assets/icons-HGhpVPVr.js">
|
|
303
|
-
<link rel="modulepreload" crossorigin href="./assets/add-missing-import-
|
|
303
|
+
<link rel="modulepreload" crossorigin href="./assets/add-missing-import-Cy6g_y6i.js">
|
|
304
304
|
<link rel="modulepreload" crossorigin href="./assets/blob-B96v6VlX.js">
|
|
305
|
-
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-
|
|
305
|
+
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-D94Om7DS.js">
|
|
306
306
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-C2nGNVra.js">
|
|
307
307
|
<link rel="modulepreload" crossorigin href="./assets/square-function-DncO0xCM.js">
|
|
308
308
|
<link rel="modulepreload" crossorigin href="./assets/spec-Cdxt7KQF.js">
|
|
309
|
-
<link rel="modulepreload" crossorigin href="./assets/focus-
|
|
309
|
+
<link rel="modulepreload" crossorigin href="./assets/focus-CUS3ckCE.js">
|
|
310
310
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-B1IBfLxp.js">
|
|
311
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
312
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
311
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BsCKvnq_.js">
|
|
312
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-CWXmrhes.js">
|
|
313
313
|
<link rel="modulepreload" crossorigin href="./assets/toggle-CPnmDQd7.js">
|
|
314
314
|
<link rel="modulepreload" crossorigin href="./assets/api-qc-D7yz9.js">
|
|
315
315
|
<link rel="modulepreload" crossorigin href="./assets/globals-Bcw0dX52.js">
|
|
@@ -318,22 +318,22 @@
|
|
|
318
318
|
<link rel="modulepreload" crossorigin href="./assets/memoize-DhF8x4Aa.js">
|
|
319
319
|
<link rel="modulepreload" crossorigin href="./assets/_toKey-16owuO_q.js">
|
|
320
320
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-L2qemYhz.js">
|
|
321
|
-
<link rel="modulepreload" crossorigin href="./assets/utilities.esm-
|
|
322
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
321
|
+
<link rel="modulepreload" crossorigin href="./assets/utilities.esm-CCw2KKJk.js">
|
|
322
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-BXSB3SQ6.js">
|
|
323
323
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-BIDUS-iw.js">
|
|
324
324
|
<link rel="modulepreload" crossorigin href="./assets/plus-DWAWtOBJ.js">
|
|
325
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
325
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-Ba_IF_mK.js">
|
|
326
326
|
<link rel="modulepreload" crossorigin href="./assets/file-video-camera-gcIrLbdD.js">
|
|
327
327
|
<link rel="modulepreload" crossorigin href="./assets/file-text-Z92DzmMA.js">
|
|
328
328
|
<link rel="modulepreload" crossorigin href="./assets/file-Cesos4Qp.js">
|
|
329
|
-
<link rel="modulepreload" crossorigin href="./assets/types-
|
|
329
|
+
<link rel="modulepreload" crossorigin href="./assets/types-h5wz3HYN.js">
|
|
330
330
|
<link rel="modulepreload" crossorigin href="./assets/label-FIGQlkj5.js">
|
|
331
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
331
|
+
<link rel="modulepreload" crossorigin href="./assets/form-nAUuUhu3.js">
|
|
332
332
|
<link rel="modulepreload" crossorigin href="./assets/textarea-DA_SbCD5.js">
|
|
333
333
|
<link rel="modulepreload" crossorigin href="./assets/circle-x-Bb-EcEyG.js">
|
|
334
334
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-ETV_gv20.js">
|
|
335
335
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-D1jEfGpj.js">
|
|
336
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
336
|
+
<link rel="modulepreload" crossorigin href="./assets/form-BlnK1x-p.js">
|
|
337
337
|
<link rel="modulepreload" crossorigin href="./assets/field-mNGJv_67.js">
|
|
338
338
|
<link rel="modulepreload" crossorigin href="./assets/switch-p-zRh0zu.js">
|
|
339
339
|
<link rel="modulepreload" crossorigin href="./assets/useBoolean-CG31RE8p.js">
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
<link rel="stylesheet" crossorigin href="./assets/cells-BvrC6Bsv.css">
|
|
359
359
|
<link rel="stylesheet" crossorigin href="./assets/Output-j3zW187k.css">
|
|
360
360
|
<link rel="stylesheet" crossorigin href="./assets/ConsoleOutput-BFFTcC5Y.css">
|
|
361
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
361
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BmcO-QYJ.css">
|
|
362
362
|
</head>
|
|
363
363
|
<body>
|
|
364
364
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/frontend",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
"typescript-memoize": "^1.1.1",
|
|
169
169
|
"use-acp": "0.2.5",
|
|
170
170
|
"use-resize-observer": "^9.1.0",
|
|
171
|
-
"vega-lite": "
|
|
171
|
+
"vega-lite": "6.2.0",
|
|
172
172
|
"vega-loader": "^5.1.0",
|
|
173
173
|
"vega-parser": "^7.1.0",
|
|
174
174
|
"vega-tooltip": "^1.1.0",
|
|
@@ -27,8 +27,10 @@ describe("MarkdownLanguageAdapter", () => {
|
|
|
27
27
|
const out = adapter.transformOut(innerCode, metadata);
|
|
28
28
|
expect(out).toMatchInlineSnapshot(`
|
|
29
29
|
[
|
|
30
|
-
"mo.md(r"""
|
|
31
|
-
|
|
30
|
+
"mo.md(r"""
|
|
31
|
+
|
|
32
|
+
""")",
|
|
33
|
+
12,
|
|
32
34
|
]
|
|
33
35
|
`);
|
|
34
36
|
});
|
|
@@ -227,8 +229,10 @@ describe("MarkdownLanguageAdapter", () => {
|
|
|
227
229
|
it("empty string", () => {
|
|
228
230
|
const code = "";
|
|
229
231
|
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
230
|
-
expect(wrappedCode).toBe(`mo.md("""
|
|
231
|
-
|
|
232
|
+
expect(wrappedCode).toBe(`mo.md("""
|
|
233
|
+
|
|
234
|
+
""")`);
|
|
235
|
+
expect(offset).toBe(11);
|
|
232
236
|
});
|
|
233
237
|
|
|
234
238
|
it("defaults to r-string when there is no last quote prefix", () => {
|
|
@@ -236,15 +240,19 @@ describe("MarkdownLanguageAdapter", () => {
|
|
|
236
240
|
const code = "Hello world";
|
|
237
241
|
metadata.quotePrefix = "r";
|
|
238
242
|
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
239
|
-
expect(wrappedCode).toBe(`mo.md(r"""
|
|
240
|
-
|
|
243
|
+
expect(wrappedCode).toBe(`mo.md(r"""
|
|
244
|
+
Hello world
|
|
245
|
+
""")`);
|
|
246
|
+
expect(offset).toBe(12);
|
|
241
247
|
});
|
|
242
248
|
|
|
243
249
|
it("single line", () => {
|
|
244
250
|
const code = "Hello world";
|
|
245
251
|
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
246
|
-
expect(wrappedCode).toBe(`mo.md("""
|
|
247
|
-
|
|
252
|
+
expect(wrappedCode).toBe(`mo.md("""
|
|
253
|
+
Hello world
|
|
254
|
+
""")`);
|
|
255
|
+
expect(offset).toBe(11);
|
|
248
256
|
});
|
|
249
257
|
|
|
250
258
|
it("starts with quote", () => {
|
|
@@ -283,21 +291,36 @@ describe("MarkdownLanguageAdapter", () => {
|
|
|
283
291
|
});
|
|
284
292
|
|
|
285
293
|
it("should escape triple quotes in the Markdown code", () => {
|
|
286
|
-
const code = 'Markdown with an escaped """quote"""!!';
|
|
294
|
+
const code = 'Markdown with an escaped """quote""""!!';
|
|
287
295
|
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
288
296
|
expect(wrappedCode).toBe(
|
|
289
|
-
`mo.md("""
|
|
297
|
+
`mo.md("""
|
|
298
|
+
Markdown with an escaped "\\""quote"\\""\\"!!
|
|
299
|
+
""")`,
|
|
290
300
|
);
|
|
291
|
-
expect(offset).toBe(
|
|
301
|
+
expect(offset).toBe(11);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("should escape triple quotes in the Markdown code with backslash", () => {
|
|
305
|
+
const code = 'Markdown with an escaped \\"""quote\\""""!!';
|
|
306
|
+
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
307
|
+
expect(wrappedCode).toBe(
|
|
308
|
+
`mo.md("""
|
|
309
|
+
Markdown with an escaped \\"\\""quote\\"\\""\\"!!
|
|
310
|
+
""")`,
|
|
311
|
+
);
|
|
312
|
+
expect(offset).toBe(11);
|
|
292
313
|
});
|
|
293
314
|
|
|
294
315
|
it("should preserve r strings", () => {
|
|
295
316
|
const code = String.raw`$\nu = \mathllap{}\cdot\mathllap{\alpha}$`;
|
|
296
317
|
metadata.quotePrefix = "r";
|
|
297
318
|
const [wrappedCode, offset] = adapter.transformOut(code, metadata);
|
|
298
|
-
const pythonCode = `mo.md(r"""
|
|
319
|
+
const pythonCode = `mo.md(r"""
|
|
320
|
+
$\\nu = \\mathllap{}\\cdot\\mathllap{\\alpha}$
|
|
321
|
+
""")`;
|
|
299
322
|
expect(wrappedCode).toBe(pythonCode);
|
|
300
|
-
expect(offset).toBe(
|
|
323
|
+
expect(offset).toBe(12);
|
|
301
324
|
});
|
|
302
325
|
|
|
303
326
|
it("should handle f-strings in transformOut", () => {
|
|
@@ -146,8 +146,12 @@ describe("splitEditor", () => {
|
|
|
146
146
|
selection: { anchor: "Hello,".length },
|
|
147
147
|
});
|
|
148
148
|
const result = splitEditor(mockEditor);
|
|
149
|
-
expect(result.beforeCursorCode).toEqual(
|
|
150
|
-
|
|
149
|
+
expect(result.beforeCursorCode).toEqual(`mo.md("""
|
|
150
|
+
Hello,
|
|
151
|
+
""")`);
|
|
152
|
+
expect(result.afterCursorCode).toEqual(`mo.md("""
|
|
153
|
+
World!
|
|
154
|
+
""")`);
|
|
151
155
|
});
|
|
152
156
|
|
|
153
157
|
// f-strings not currently supported
|
package/src/css/md.css
CHANGED
|
@@ -78,8 +78,14 @@ a .markdown iconify-icon:first-child {
|
|
|
78
78
|
margin-inline-end: 0.4em;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
iconify-icon {
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
/* align icons with buttons better */
|
|
82
87
|
button .markdown .paragraph {
|
|
88
|
+
display: inline-flex;
|
|
83
89
|
align-items: baseline;
|
|
84
90
|
gap: 0.4em;
|
|
85
91
|
|
|
@@ -462,4 +462,31 @@ describe("sanitizeHtml", () => {
|
|
|
462
462
|
`"<details><summary>Click me</summary><p>Hidden content</p></details>"`,
|
|
463
463
|
);
|
|
464
464
|
});
|
|
465
|
+
|
|
466
|
+
test("preserves iconify-icon custom element", () => {
|
|
467
|
+
const html = '<iconify-icon icon="lucide:leaf"></iconify-icon>';
|
|
468
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
469
|
+
`"<iconify-icon icon="lucide:leaf"></iconify-icon>"`,
|
|
470
|
+
);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test("preserves iconify-icon with all attributes", () => {
|
|
474
|
+
const html =
|
|
475
|
+
'<iconify-icon icon="lucide:rocket" width="24px" height="24px" inline="" flip="horizontal" rotate="90deg" style="color: blue;"></iconify-icon>';
|
|
476
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
477
|
+
`"<iconify-icon icon="lucide:rocket" width="24px" height="24px" inline="" flip="horizontal" rotate="90deg" style="color: blue;"></iconify-icon>"`,
|
|
478
|
+
);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
test("preserves self-closing iconify-icon", () => {
|
|
482
|
+
const html = '<iconify-icon icon="lucide:star" />';
|
|
483
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
484
|
+
`"<iconify-icon icon="lucide:star"></iconify-icon>"`,
|
|
485
|
+
);
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test("still removes other non-marimo/non-iconify custom elements", () => {
|
|
489
|
+
const html = "<some-custom-element>Content</some-custom-element>";
|
|
490
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(`"Content"`);
|
|
491
|
+
});
|
|
465
492
|
});
|
|
@@ -75,7 +75,7 @@ export function sanitizeHtml(html: string) {
|
|
|
75
75
|
// glue elements like style, script or others to document.body and prevent unintuitive browser behavior in several edge-cases
|
|
76
76
|
FORCE_BODY: true,
|
|
77
77
|
CUSTOM_ELEMENT_HANDLING: {
|
|
78
|
-
tagNameCheck: /^marimo-[A-Za-z][\w-]
|
|
78
|
+
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
79
79
|
attributeNameCheck: /^[A-Za-z][\w-]*$/,
|
|
80
80
|
},
|
|
81
81
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
-
import { type JSX, useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { type JSX, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { once } from "@/utils/once";
|
|
@@ -21,7 +21,10 @@ export class TexPlugin implements IStatelessPlugin<{}> {
|
|
|
21
21
|
|
|
22
22
|
render(props: IStatelessPluginProps<{}>): JSX.Element {
|
|
23
23
|
return (
|
|
24
|
-
<TexComponent
|
|
24
|
+
<TexComponent
|
|
25
|
+
host={props.host}
|
|
26
|
+
tex={props.host.textContent || props.host.innerHTML}
|
|
27
|
+
/>
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -67,8 +70,33 @@ async function renderLatex(mount: HTMLElement, tex: string): Promise<void> {
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
const TexComponent = ({
|
|
73
|
+
const TexComponent = ({
|
|
74
|
+
host,
|
|
75
|
+
tex,
|
|
76
|
+
}: {
|
|
77
|
+
host: HTMLElement;
|
|
78
|
+
tex: string;
|
|
79
|
+
}): JSX.Element => {
|
|
71
80
|
const ref = useRef<HTMLSpanElement>(null);
|
|
81
|
+
const [currentTex, setCurrentTex] = useState(tex);
|
|
82
|
+
|
|
83
|
+
// Watch for changes to the host element's direct children
|
|
84
|
+
useLayoutEffect(() => {
|
|
85
|
+
const observer = new MutationObserver(() => {
|
|
86
|
+
const newTex = host.textContent || host.innerHTML;
|
|
87
|
+
setCurrentTex(newTex);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
observer.observe(host, {
|
|
91
|
+
childList: true,
|
|
92
|
+
characterData: true,
|
|
93
|
+
subtree: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return () => {
|
|
97
|
+
observer.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, [host]);
|
|
72
100
|
|
|
73
101
|
// The arithmatex markdown extension we use in Python produces nested
|
|
74
102
|
// marimo-tex tags when $$...$$ math is used in a paragraph, with dummy
|
|
@@ -94,9 +122,9 @@ const TexComponent = ({ tex }: { tex: string }): JSX.Element => {
|
|
|
94
122
|
// Re-render when the text content changes.
|
|
95
123
|
useLayoutEffect(() => {
|
|
96
124
|
if (ref.current) {
|
|
97
|
-
renderLatex(ref.current,
|
|
125
|
+
renderLatex(ref.current, currentTex);
|
|
98
126
|
}
|
|
99
|
-
}, [
|
|
127
|
+
}, [currentTex]);
|
|
100
128
|
|
|
101
129
|
return <span ref={ref} />;
|
|
102
130
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as p}from"./chunk-DZLz74EQ.js";import{c as S,d as j}from"./jotai-BTnrNcC1.js";import{t as _}from"./react-BcIddLXZ.js";import{br as u,yr as w}from"./cells-ChcCEAp9.js";import{t as y}from"./compiler-runtime-Cr9loedd.js";import{t as N}from"./jsx-runtime-mwDPpfh_.js";import{t as R}from"./mode-47luhzpx.js";import{t as z}from"./usePress-C2JVmCUi.js";import{t as k}from"./copy-icon-Ckew1l1_.js";import{t as A}from"./purify.es-CmG1k0Cr.js";import{t as C}from"./useRunCells-BmIxLPpn.js";var H=p(y(),1),m=p(_(),1),s=p(N(),1);const M=e=>{let t=(0,H.c)(16),r,a,i;t[0]===e?(r=t[1],a=t[2],i=t[3]):({href:a,children:r,...i}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=i);let o=(0,m.useRef)(null),l;t[4]===a?l=t[5]:(l=()=>{let h=new URL(globalThis.location.href);h.hash=a,globalThis.history.pushState({},"",h.toString());let x=a.slice(1),v=document.getElementById(x);v&&v.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=a,t[5]=l);let n=l,c;t[6]===n?c=t[7]:(c={onPress:()=>{n()}},t[6]=n,t[7]=c);let{pressProps:g}=z(c),f;t[8]===n?f=t[9]:(f=h=>{h.preventDefault(),n()},t[8]=n,t[9]=f);let E=f,d;return t[10]!==r||t[11]!==E||t[12]!==a||t[13]!==g||t[14]!==i?(d=(0,s.jsx)("a",{ref:o,href:a,...g,onClick:E,...i,children:r}),t[10]=r,t[11]=E,t[12]=a,t[13]=g,t[14]=i,t[15]=d):d=t[15],d};var T=j(e=>{if(e(C))return!1;let t=!0;try{t=R()==="read"}catch{return!0}return!t});function F(){return S(T)}var b="data-temp-href-target";A.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&(e.hasAttribute("target")||e.setAttribute("target","_self"),e.hasAttribute("target")&&e.setAttribute(b,e.getAttribute("target")||""))}),A.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(b)&&(e.setAttribute("target",e.getAttribute(b)||""),e.removeAttribute(b),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))});function L(e){return A.sanitize(e,{USE_PROFILES:{html:!0,svg:!0,mathMl:!0},FORCE_BODY:!0,CUSTOM_ELEMENT_HANDLING:{tagNameCheck:/^marimo-[A-Za-z][\w-]*$/,attributeNameCheck:/^[A-Za-z][\w-]*$/}})}var O=p(y(),1),I=e=>{if(e instanceof u.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return m.createElement(m.Fragment)},D=(e,t)=>{if(t instanceof u.Element&&t.name==="body"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,s.jsx)(s.Fragment,{children:r})}return}},V=(e,t)=>{if(t instanceof u.Element&&t.name==="html"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,s.jsx)(s.Fragment,{children:r})}return}},W=e=>{if(e instanceof u.Element&&e.attribs&&e.name==="iframe"){let t=document.createElement("iframe");return Object.entries(e.attribs).forEach(([r,a])=>{r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),t.setAttribute(r,a)}),(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},$=e=>{if(e instanceof u.Element&&e.name==="script"){let t=e.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let r=document.createElement("script");r.src=t,document.head.append(r)}return(0,s.jsx)(s.Fragment,{})}},P=(e,t)=>{if(t instanceof u.Element&&t.name==="a"){let r=t.attribs.href;if(r!=null&&r.startsWith("#")&&!r.startsWith("#code/")){let a=null;return(0,m.isValidElement)(e)&&"props"in e&&(a=e.props.children),(0,s.jsx)(M,{href:r,...t.attribs,children:a})}}},U=(e,t,r)=>{var a,i;if(t instanceof u.Element&&t.name==="div"&&((i=(a=t.attribs)==null?void 0:a.class)!=null&&i.includes("codehilite")))return(0,s.jsx)(Z,{children:e},r)},Z=e=>{let t=(0,O.c)(3),{children:r}=e,a=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,s.jsx)(k,{tooltip:!1,className:"p-1",value:()=>{var n;let l=(n=a.current)==null?void 0:n.firstChild;return l&&l.textContent||""}})}),t[0]=i):i=t[0];let o;return t[1]===r?o=t[2]:(o=(0,s.jsxs)("div",{className:"relative group codehilite-wrapper",ref:a,children:[r,i]}),t[1]=r,t[2]=o),o};const B=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r=!0})=>(0,s.jsx)(q,{html:e,alwaysSanitizeHtml:r,additionalReplacements:t});var q=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r})=>{let a=F();return G({html:(0,m.useMemo)(()=>r||a?L(e):e,[e,r,a]),additionalReplacements:t})};function G({html:e,additionalReplacements:t=[]}){let r=[I,W,$,...t],a=[U,P,D,V];return w(e,{replace:(i,o)=>{for(let l of r){let n=l(i,o);if(n)return n}return i},transform:(i,o,l)=>{for(let n of a){let c=n(i,o,l);if(c)return c}return i}})}export{B as t};
|