index.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <!--To run this example from a clone of the repository, run `yarn start`
  3. in the root KaTeX directory and then visit with your web browser:
  4. http://localhost:7936/contrib/auto-render/index.html
  5. -->
  6. <html>
  7. <head>
  8. <meta charset="UTF-8">
  9. <title>Auto-render test</title>
  10. <script src="/katex.js" type="text/javascript"></script>
  11. <script src="/contrib/auto-render.js" type="text/javascript"></script>
  12. <style type="text/css">
  13. body {
  14. margin: 0px;
  15. padding: 0px;
  16. font-size: 36px;
  17. }
  18. #test > .blue {
  19. color: blue;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id="test">
  25. This is some text $math \frac12$ other text $\unsupported$
  26. <span class="blue">
  27. Other node \[ displaymath \frac{1}{2} \] blah $$ \int_2^3 $$
  28. </span>
  29. and some <!-- comment --> more text \(and math\) blah. And $math with a
  30. \$ sign$.
  31. <pre>
  32. Stuff in a $pre tag$
  33. </pre>
  34. </div>
  35. <script>
  36. renderMathInElement(
  37. document.getElementById("test"),
  38. {
  39. delimiters: [
  40. {left: "$$", right: "$$", display: true},
  41. {left: "\\[", right: "\\]", display: true},
  42. {left: "$", right: "$", display: false},
  43. {left: "\\(", right: "\\)", display: false}
  44. ]
  45. }
  46. );
  47. </script>
  48. </body>
  49. </html>