1

如何将 KaTeX 集成到此处给出的存储卡应用程序中。

存储库:https ://github.com/bradtraversy/vanillawebprojects

演示:https ://vanillawebprojects.com/projects/memory-cards/

我已经在里面添加了 katex 文件并尝试了。它不工作。

我希望存储卡的正面和背面都接受 KaTeX。

带有 KaTeX 链接的完整存储卡应用程序的 zip 文件在此处上传 https://workupload.com/file/jypmgv5p

html文件添加在[index.html]下面

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />


    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css"
      integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
      crossorigin="anonymous"
    />
    <link rel="stylesheet" href="style.css" />



    <title>Memory Cards</title>
  </head>
  <body>
    <button id="clear" class="clear btn">
      <i class="fas fa-trash"></i> Clear Cards
    </button>

    <h1>
      Memory Cards
      <button id="show" class="btn btn-small">
        <i class="fas fa-plus"></i> Add New Card
      </button>
    </h1>

    <div id="cards-container" class="cards">
     <div class="card active">
        <div class="inner-card">
          <div class="inner-card-front">
            <p>
              What is PHP?
            </p>
          </div>
          <div class="inner-card-back">
            <p>
              A programming language
            </p>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="inner-card">
          <div class="inner-card-front">
            <p>
              What is PHP?
            </p>
          </div>
          <div class="inner-card-back">
            <p>
              A programming language
            </p>
          </div>
        </div>
      </div>
    </div>

    <div class="navigation">
      <button id="prev" class="nav-button">
        <i class="fas fa-arrow-left"></i>
      </button>

      <p id="current"></p>

      <button id="next" class="nav-button">
        <i class="fas fa-arrow-right"></i>
      </button>
    </div>

    <div id="add-container" class="add-container">
      <h1>
        Add New Card
        <button id="hide" class="btn btn-small btn-ghost">
          <i class="fas fa-times"></i>
        </button>
      </h1>

      <div class="form-group">
        <label for="question">Question</label>
        <textarea id="question" placeholder="Enter question..."></textarea>
      </div>

      <div class="form-group">
        <label for="answer">Answer</label>
        <textarea id="answer" placeholder="Enter Answer..."></textarea>
      </div>

      <button id="add-card" class="btn">
        <i class="fas fa-plus"></i> Add Card
      </button>
    </div>

    <script src="script.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">

    <!-- The loading of KaTeX is deferred to speed up page rendering -->
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>

    <!-- To automatically render math in text elements, include the auto-render extension: -->
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
        onload="renderMathInElement(document.body);"></script>
  </body>
</html>
4

0 回答 0