@marimo-team/islands 0.25.2-dev106 → 0.25.2-dev109
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/{ErrorBoundary-DrWVvMqC.js → ErrorBoundary-BqyKvcCy.js} +1 -1
- package/dist/{cells-CvBCD5iu.js → cells-CnomFgoS.js} +2948 -2928
- package/dist/{chat-ui-h9kErePX.js → chat-ui-DIoRDU4g.js} +4 -4
- package/dist/{code-visibility-DdgAmJmC.js → code-visibility-5NC1aIxF.js} +2 -2
- package/dist/{common-DGkl4Eds.js → common-B6A_WCjp.js} +3 -3
- package/dist/{data-grid-overlay-editor-i49eMiEh.js → data-grid-overlay-editor-D-TLNXor.js} +1 -1
- package/dist/{error-entries-CfSQn4ZJ.js → error-entries-uqmpke4z.js} +1 -1
- package/dist/{feedback-button-A2AHC02G.js → feedback-button-Bu8T_1Jx.js} +4 -4
- package/dist/{glide-data-editor-C_Y83eDT.js → glide-data-editor-DSIJAiQj.js} +3 -3
- package/dist/{globals-C8J09ZJ3.js → globals-CC5F6u7e.js} +1 -1
- package/dist/{html-to-image-ASL72siI.js → html-to-image-utL-jAuh.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/{number-overlay-editor-Cp9NfidD.js → number-overlay-editor-BVm0umyX.js} +1 -1
- package/dist/{process-output-sgQSi4QO.js → process-output-tkY7JSAu.js} +2 -2
- package/dist/{reveal-component-CBoV9nSd.js → reveal-component-b9kFH1m4.js} +3 -3
- package/package.json +1 -1
- package/src/core/cells/__tests__/document-roundtrip.test.ts +16 -0
- package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +138 -26
- package/src/core/codemirror/language/embedded/embedded-python.ts +47 -13
- package/src/core/codemirror/language/embedded/latex.ts +20 -13
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
30
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
31
|
|
|
32
|
-
import { type Parser, parseMixed } from "@lezer/common";
|
|
32
|
+
import { IterMode, type Parser, parseMixed } from "@lezer/common";
|
|
33
33
|
import { tags } from "@lezer/highlight";
|
|
34
34
|
import type {
|
|
35
35
|
DelimiterType,
|
|
@@ -231,24 +231,31 @@ export function parseLatex(latexParser: Parser): MarkdownConfig {
|
|
|
231
231
|
// Test if the node type is one of the math expression
|
|
232
232
|
const delimiterLength = DELIMITER_LENGTH[node.type.name];
|
|
233
233
|
if (delimiterLength) {
|
|
234
|
-
const from = node.from + delimiterLength;
|
|
235
|
-
const to = node.to - delimiterLength;
|
|
234
|
+
const from = node.node.firstChild?.to ?? node.from + delimiterLength;
|
|
235
|
+
const to = node.node.lastChild?.from ?? node.to - delimiterLength;
|
|
236
236
|
|
|
237
237
|
// Ensure valid ranges
|
|
238
238
|
if (from >= to || from < 0 || to < 0) {
|
|
239
239
|
return null;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
242
|
+
// Leave Python replacements to their own parser and highlighter.
|
|
243
|
+
const overlay: { from: number; to: number }[] = [];
|
|
244
|
+
let start = from;
|
|
245
|
+
node.node.cursor(IterMode.IgnoreMounts).iterate((child) => {
|
|
246
|
+
if (child.name !== "Python") {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (start < child.from) {
|
|
250
|
+
overlay.push({ from: start, to: child.from });
|
|
251
|
+
}
|
|
252
|
+
start = child.to;
|
|
253
|
+
return false;
|
|
254
|
+
});
|
|
255
|
+
if (start < to) {
|
|
256
|
+
overlay.push({ from: start, to });
|
|
257
|
+
}
|
|
258
|
+
return overlay.length ? { parser: latexParser, overlay } : null;
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
return null;
|