File size: 1,946 Bytes
7bb993b
0acba39
7bb993b
0acba39
 
97c7847
 
0acba39
 
 
 
 
7bb993b
0acba39
 
 
 
 
bdc793b
 
 
 
0acba39
81fd17d
0acba39
 
 
81fd17d
0acba39
dcd1453
0acba39
97c7847
 
dcd1453
bdc793b
 
 
 
 
 
 
 
 
 
 
 
97c7847
fb0267d
0acba39
 
97c7847
fb0267d
 
 
 
 
 
 
 
 
97c7847
fb0267d
 
97c7847
 
fb0267d
97c7847
fb0267d
 
 
 
 
97c7847
 
 
 
 
 
0acba39
dcd1453
7bb993b
97c7847
 
fb0267d
 
 
 
97c7847
 
 
 
 
7bb993b
0acba39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.5.1/github-markdown-dark.min.css">

<style>
body{
  background:#0d1117;
}

.markdown-body{
  max-width:980px;
  margin:40px auto;
  padding:45px;
}

.mermaid svg {
  max-width: 100%;
}
</style>

</head>

<body>

<article id="content" class="markdown-body"></article>

<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>

<script>
mermaid.initialize({
  startOnLoad:false,
  theme:"dark",
  themeVariables:{
    background:"#0d1117",
    primaryColor:"#1f6feb",
    primaryTextColor:"#c9d1d9",
    lineColor:"#8b949e",
    secondaryColor:"#161b22",
    tertiaryColor:"#21262d"
  }
});

fetch("./deep-research-report.md")   // same HF space
.then(r => r.text())
.then(md => {

  // remove weird research citation artifacts
  md = md.replace(/【.*?†.*?】/g, "");

  // auto-detect formulas like (WM_t = WM_{t-1} \cup {C_t})
  md = md.replace(/\(([A-Za-z0-9_\-\s\\{}=+\cup]+)\)/g, (m,p)=>{
    if(p.includes("_") || p.includes("\\") || p.includes("="))
      return `$(${p})$`;
    return m;
  });

  // convert markdown → html
  const html = marked.parse(md);
  document.getElementById("content").innerHTML = html;

  // convert mermaid blocks
  document.querySelectorAll("code.language-mermaid").forEach(el=>{
    const pre = el.parentElement;
    const div = document.createElement("div");
    div.className="mermaid";
    div.textContent = el.textContent;
    pre.replaceWith(div);
  });

  mermaid.init();

  // render math
  MathJax.typeset();
});
</script>

<script>
window.MathJax = {
  tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']],
    displayMath: [['$$','$$']]
  }
};
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

</body>
</html>