diff --git a/Source/Chatbook/Formatting.wl b/Source/Chatbook/Formatting.wl index 9030acf2..e9af28cf 100644 --- a/Source/Chatbook/Formatting.wl +++ b/Source/Chatbook/Formatting.wl @@ -1140,6 +1140,8 @@ $$simpleToolCall = Shortest[ $$simpleToolCommand ~~ ___ ~~ ($$endToolCall|End (* ::Subsection::Closed:: *) (*$textDataFormatRules*) $textDataFormatRules = { + "```" ~~ code: Except[ "\n" ].. ~~ "```" :> inlineCodeCell @ code, + StringExpression[ Longest[ "```" ~~ language: Except[ "\n" ]... ] ~~ (" "...) ~~ "\n", Shortest[ code__ ], diff --git a/Source/Chatbook/SendChat.wl b/Source/Chatbook/SendChat.wl index 5c26be1a..ffd15292 100644 --- a/Source/Chatbook/SendChat.wl +++ b/Source/Chatbook/SendChat.wl @@ -895,6 +895,7 @@ autoCorrect[ string_String ] := StringReplace[ string, $llmAutoCorrectRules ]; autoCorrect // endDefinition; $llmAutoCorrectRules := $llmAutoCorrectRules = Flatten @ { + "```" ~~ code: Except[ "\n" ].. ~~ "```" :> "``"<>code<>"``", "wolfram_language_evaliator" -> "wolfram_language_evaluator", "\\!\\(\\*MarkdownImageBox[\"" ~~ Shortest[ uri__ ] ~~ "\"]\\)" :> uri, "\\!\\(MarkdownImageBox[\"" ~~ Shortest[ uri__ ] ~~ "\"]\\)" :> uri,