Skip to content

Commit

Permalink
Backport PR jupyterlab#1155: Fix code output format in IPython
Browse files Browse the repository at this point in the history
  • Loading branch information
divyansshhh authored and meeseeksmachine committed Dec 18, 2024
1 parent 135bc8f commit 3aea83b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/jupyter-ai-magics/jupyter_ai_magics/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,7 @@ def display_output(self, output, display_format, md):
lang_indicator = r"^```[a-zA-Z0-9]*\n"
output = re.sub(lang_indicator, "", output)
output = re.sub(r"\n```$", "", output)
new_cell_payload = dict(
source="set_next_input",
text=output,
replace=False,
)
ip = self.shell
ip.payload_manager.write_payload(new_cell_payload)
self.shell.set_next_input(output, replace=False)
return HTML(
"AI generated code inserted below ⬇️", metadata=md
)
Expand Down

0 comments on commit 3aea83b

Please sign in to comment.