Skip to content

Commit cf5f2b8

Browse files
committed
Fix Deno display_data to use broadcast API
The Deno.jupyter.html tagged template doesn't emit display_data messages. Use Deno.jupyter.broadcast("display_data", ...) which is proven to work. Also clarify evcxr requires trait impl for display_data.
1 parent 87ccfaa commit cf5f2b8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/snippets.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl LanguageSnippets {
109109
completion_var: "test_variable_for_completion",
110110
completion_setup: "let test_variable_for_completion = 42;",
111111
completion_prefix: "test_variable_for_",
112-
display_data_code: r#"println!("EVCXR_BEGIN_CONTENT text/html\n<b>bold</b>\nEVCXR_END_CONTENT")"#,
112+
display_data_code: "// evcxr requires evcxr_display trait impl for display_data",
113113
update_display_data_code: "// evcxr doesn't support update_display_data (no display_id)",
114114
}
115115
}
@@ -150,7 +150,7 @@ impl LanguageSnippets {
150150
completion_var: "testVariableForCompletion",
151151
completion_setup: "const testVariableForCompletion = 42",
152152
completion_prefix: "testVariableFor",
153-
display_data_code: "Deno.jupyter.html`<b>bold</b>`",
153+
display_data_code: r#"await Deno.jupyter.broadcast("display_data", { data: { "text/html": "<b>bold</b>" }, metadata: {}, transient: {} })"#,
154154
update_display_data_code: r#"await Deno.jupyter.broadcast("display_data", { data: { "text/html": "<b>initial</b>" }, metadata: {}, transient: { display_id: "test_update" } }); await Deno.jupyter.broadcast("update_display_data", { data: { "text/html": "<b>updated</b>" }, metadata: {}, transient: { display_id: "test_update" } })"#,
155155
}
156156
}

0 commit comments

Comments
 (0)