Skip to content

Commit

Permalink
Strips prefix and suffix (jupyterlab#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonWeill authored and Marchlak committed Oct 28, 2024
1 parent 48ed36f commit ee90e89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/jupyter-ai-magics/jupyter_ai_magics/magics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import json
import os
import warnings
from typing import Optional

Expand Down Expand Up @@ -189,6 +189,8 @@ def ai(self, line, cell=None):

# if the user wants code, add another cell with the output.
if args.format == 'code':
# Strip leading and trailing triple-backticks
output = output.removeprefix('```\n').removesuffix('\n```')
new_cell_payload = dict(
source='set_next_input',
text=output,
Expand Down

0 comments on commit ee90e89

Please sign in to comment.