Skip to content

Commit

Permalink
Use triple quote when remote cell content contains a quote (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko authored Aug 19, 2024
1 parent 56a0171 commit c65867b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kino/remote_execution_cell.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
9 changes: 8 additions & 1 deletion test/kino/remote_execution_cell_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")

Expand Down

0 comments on commit c65867b

Please sign in to comment.