Skip to content

Commit ce5d589

Browse files
committed
fixes #78
1 parent 56e22c7 commit ce5d589

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

nbs/00_core.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@
882882
" trust: str = None, # Comma-delimited list of tools to always allow (e.g. \"view,rg\")\n",
883883
" code_theme: str = None, # The code theme to use when rendering ShellSage's responses\n",
884884
" code_lexer: str = None, # The lexer to use for inline code markdown blocks\n",
885+
" raw: bool = False, # Skip markdown rendering and print plain text\n",
885886
"):\n",
886887
" safecmd = None\n",
887888
" opts = get_opts(history_lines=history_lines, model=model, search=search,\n",
@@ -896,8 +897,11 @@
896897
" if mode not in ['default', 'sassy']:\n",
897898
" raise Exception(f\"{mode} is not valid. Must be one of the following: ['default', 'sassy']\")\n",
898899
" \n",
899-
" _md = partial(Markdown, code_theme=opts.code_theme, inline_code_lexer=opts.code_lexer,\n",
900+
" _md = noop if raw else partial(Markdown, code_theme=opts.code_theme, inline_code_lexer=opts.code_lexer,\n",
900901
" inline_code_theme=opts.code_theme)\n",
902+
" if raw:\n",
903+
" global print\n",
904+
" print = Console(width=2**15).print\n",
901905
" query = ' '.join(query)\n",
902906
" ctxt = '' if skip_system else _sys_info()\n",
903907
"\n",

shell_sage/core.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def main(
270270
trust: str = None, # Comma-delimited list of tools to always allow (e.g. "view,rg")
271271
code_theme: str = None, # The code theme to use when rendering ShellSage's responses
272272
code_lexer: str = None, # The lexer to use for inline code markdown blocks
273+
raw: bool = False, # Skip markdown rendering and print plain text
273274
):
274275
safecmd = None
275276
opts = get_opts(history_lines=history_lines, model=model, search=search,
@@ -284,8 +285,11 @@ def main(
284285
if mode not in ['default', 'sassy']:
285286
raise Exception(f"{mode} is not valid. Must be one of the following: ['default', 'sassy']")
286287

287-
_md = partial(Markdown, code_theme=opts.code_theme, inline_code_lexer=opts.code_lexer,
288+
_md = noop if raw else partial(Markdown, code_theme=opts.code_theme, inline_code_lexer=opts.code_lexer,
288289
inline_code_theme=opts.code_theme)
290+
if raw:
291+
global print
292+
print = Console(width=2**15).print
289293
query = ' '.join(query)
290294
ctxt = '' if skip_system else _sys_info()
291295

0 commit comments

Comments
 (0)