Skip to content

Commit cf750c4

Browse files
BarbuiaPhMemmel
andauthored
Apply suggestion from @PhMemmel
Co-authored-by: PhMemmel <65113153+PhMemmel@users.noreply.github.com>
1 parent 5ed8faf commit cf750c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

classes/base_purpose.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ public function format_output(string $output): string {
180180
// It uses MarkdownExtra which already escapes HTML inside code blocks by default.
181181
$html = markdown_to_html($output);
182182

183-
// Final security layer: sanitize HTML while preserving markdown-generated structure.
184-
// This prevents XSS from raw HTML that the LLM might return outside of code blocks.
183+
// Finally apply moodle output function for both sanitizing and other moodle specific formatting.
184+
// Previously converted markdown-generated structure is being preserved.
185+
// This prevents XSS from raw HTML that the LLM might return.
185186
return format_text($html, FORMAT_MOODLE, ['filter' => false, 'newlines' => false]);
186187
}
187188

0 commit comments

Comments
 (0)