File size: 1,902 Bytes
ae1d809
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./lib/katex.min.css" />
    <script src="./lib/katex.min.js"></script>
    <script src="./lib/auto-render.min.js"></script>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
      }
      #container {
        width: 100vw;
      }
      .screenshot {
        margin: 5px;
        display: inline-block;
        white-space: pre-wrap;
        word-break: break-all;
        font-size: 30px;
      }
      .annotated {
        border: 1px solid red;
      }
    </style>
  </head>
  <body>
    <div id="container"></div>

    <script>
      const FIXED_FONT =
        "'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif";

      function render(texts, show_rect = false) {
        const container = document.getElementById('container');
        container.innerHTML = '';

        for (let i = 0; i < texts.length; i++) {
          const div = document.createElement('div');
          div.className = `screenshot${show_rect ? ' annotated' : ''}`;
          div.style.fontFamily = FIXED_FONT; // 应用系统字体
          const lineHeight = 1.2;
          div.style.lineHeight = lineHeight + 'em';
          div.style.fontSize = '30px';
          div.textContent = texts[i];
          container.appendChild(div);
        }

        renderMathInElement(container, {
          delimiters: [
            { left: '$$', right: '$$', display: true },
            { left: '$', right: '$', display: false },
          ],
          throwOnError: false,
          maxExpand: 20000,
          trust: true, 
          strict: false 
        });
        document.body.classList.add('rendering-complete');
      }
    </script>
  </body>
</html>