diff --git a/src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instruction.component.ts b/src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instruction.component.ts index d53b738b3ff1..b978289acf7d 100644 --- a/src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instruction.component.ts +++ b/src/main/webapp/app/exercises/programming/shared/instructions-render/programming-exercise-instruction.component.ts @@ -304,7 +304,8 @@ export class ProgrammingExerciseInstructionComponent implements OnChanges, OnDes const updatedMarkdown = htmlForMarkdown(this.examExerciseUpdateHighlighterComponent.updatedProblemStatement, this.markdownExtensions); const diffedMarkdown = diff(outdatedMarkdown, updatedMarkdown); const markdownWithoutTasks = this.prepareTasks(diffedMarkdown); - this.renderedMarkdown = this.sanitizer.bypassSecurityTrustHtml(markdownWithoutTasks); + const markdownWithTableStyles = this.addStylesForTables(markdownWithoutTasks); + this.renderedMarkdown = this.sanitizer.bypassSecurityTrustHtml(markdownWithTableStyles ?? markdownWithoutTasks); // Differences between UMLs are ignored, and we only inject the current one setTimeout(() => { const injectUML = this.injectableContentForMarkdownCallbacks[this.injectableContentForMarkdownCallbacks.length - 1]; @@ -317,7 +318,8 @@ export class ProgrammingExerciseInstructionComponent implements OnChanges, OnDes this.injectableContentForMarkdownCallbacks = []; const renderedProblemStatement = htmlForMarkdown(this.exercise.problemStatement, this.markdownExtensions); const markdownWithoutTasks = this.prepareTasks(renderedProblemStatement); - this.renderedMarkdown = this.sanitizer.bypassSecurityTrustHtml(markdownWithoutTasks); + const markdownWithTableStyles = this.addStylesForTables(markdownWithoutTasks); + this.renderedMarkdown = this.sanitizer.bypassSecurityTrustHtml(markdownWithTableStyles ?? markdownWithoutTasks); setTimeout(() => { this.injectableContentForMarkdownCallbacks.forEach((callback) => { callback(); @@ -327,6 +329,23 @@ export class ProgrammingExerciseInstructionComponent implements OnChanges, OnDes } } + addStylesForTables(markdownWithoutTasks: string): string | undefined { + if (!markdownWithoutTasks?.includes('