YchKhan commited on
Commit
fd2364f
·
verified ·
1 Parent(s): 452d0bf

Update static/js/script.js

Browse files
Files changed (1) hide show
  1. static/js/script.js +19 -3
static/js/script.js CHANGED
@@ -995,8 +995,24 @@ function showRefinedProblems(result) {
995
  title.textContent = problem.title;
996
 
997
  const description = document.createElement('div');
998
- description.className = 'refined-problem-description';
999
- description.textContent = problem.description;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
 
1001
  // Create score display with loading spinner initially
1002
  const scoreContainer = document.createElement('div');
@@ -2966,4 +2982,4 @@ async function autoRunAllProcess() {
2966
  autoRunBtn.style.opacity = '1';
2967
  autoRunBtn.textContent = 'Auto Run All Process';
2968
  }
2969
- }
 
995
  title.textContent = problem.title;
996
 
997
  const description = document.createElement('div');
998
+ description.className = 'refined-problem-description markdown-content';
999
+
1000
+ // Use Marked.js to render Markdown
1001
+ try {
1002
+ // Configure marked options for security
1003
+ marked.setOptions({
1004
+ sanitize: false, // HTML is allowed but sanitized
1005
+ breaks: true, // Interpret line breaks as <br>
1006
+ gfm: true, // Use GitHub Flavored Markdown
1007
+ headerIds: true, // Add IDs to headers for linking
1008
+ });
1009
+
1010
+ // Render the markdown
1011
+ description.innerHTML = marked.parse(problem.description);
1012
+ } catch (e) {
1013
+ console.error('Error parsing markdown:', e);
1014
+ description.textContent = problem.description; // Fallback to plain text
1015
+ }
1016
 
1017
  // Create score display with loading spinner initially
1018
  const scoreContainer = document.createElement('div');
 
2982
  autoRunBtn.style.opacity = '1';
2983
  autoRunBtn.textContent = 'Auto Run All Process';
2984
  }
2985
+ }