Repository: livebook-dev/kino (elixir)

Issue:
Warning when code inside remote execution cell contains a string using " "
When I run that code inside the remote execution smart cell:

```elixir
"some string"
```

Elixir emits a warning saying:

```
warning: using \" to escape the closing of an uppercase sigil is deprecated, 
please use another delimiter or a lowercase sigil instead
```

Here's the screenshot:

![CleanShot 2024-08-16 at 15 23 23](https://github.com/user-attachments/assets/74f92c78-3536-4b64-9287-69cc5ddf6088)

And here's a screenshot of the code generated by the smart cell:

![CleanShot 2024-08-16 at 15 25 48](https://github.com/user-attachments/assets/d46177c6-271d-4b33-9f87-42378756e85b)


I think that's because of [a deprecation introduced in Elixir 1.17](https://github.com/elixir-lang/elixir/commit/dab3d229930b1e0379a35d7f56697aac6bf177a6).

I think we can fix the deprecation.



Pull request description:
Use triple quote when remote cell content contains a quote
Closes #464.

We could use a different delimiter, but we would checks to find one that is not present in the string, so I think it's better to just use the triple delimiter.

Patch:
diff --git a/lib/kino/remote_execution_cell.ex b/lib/kino/remote_execution_cell.ex
index 067bc74..cf71501 100644
--- a/lib/kino/remote_execution_cell.ex
+++ b/lib/kino/remote_execution_cell.ex
@@ -139,7 +139,7 @@ defmodule Kino.RemoteExecutionCell do
 
   defp quoted_code(code) do
     {delimiter, code} =
-      if String.contains?(code, "\n") do
+      if String.contains?(code, ["\n", ~s/"/]) do
         {~s["""], code <> "\n"}
       else
         {~s["], code}


Test patch:
diff --git a/test/kino/remote_execution_cell_test.exs b/test/kino/remote_execution_cell_test.exs
index 71b554c..4d5616a 100644
--- a/test/kino/remote_execution_cell_test.exs
+++ b/test/kino/remote_execution_cell_test.exs
@@ -138,7 +138,14 @@ defmodule Kino.RemoteExecutionCellTest do
                require Kino.RPC
                node = :name@node
                Node.set_cookie(node, :"node-cookie")
-               Kino.RPC.eval_string(node, ~S"\"Number #{1}\"", file: __ENV__.file)
+
+               Kino.RPC.eval_string(
+                 node,
+                 ~S"""
+                 "Number #{1}"
+                 """,
+                 file: __ENV__.file
+               )
                '''
                |> String.replace_trailing("\n", "")