From 6114b678c34b22f318103b5b48a42d93b148b85d Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 27 Feb 2024 03:11:55 +0200 Subject: [PATCH] escape code tags inside value lines --- src/server.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/server.php b/src/server.php index 1311558..d32a66e 100644 --- a/src/server.php +++ b/src/server.php @@ -282,7 +282,22 @@ $server->setHandler( $config->geminiapp->string->value ); - $result[] = $record['value']; + $lines = []; + + foreach ((array) explode(PHP_EOL, (string) $record['value']) as $line) + { + $lines[] = preg_replace( + '/^```/', + ' ```', + $line + ); + } + + $result[] = implode( + PHP_EOL, + $lines + ); + $result[] = '```'; // Link