我正在为IB数学学生建立一个在线社区,为此我计划使用 circle.so 。鉴于其功能(例如代码注入)和设计,Circle.So似乎是一个不错的选择。
论坛工具(例如圆形)需要具有的功能之一是呈现数学符号(乳胶)或允许代码注入的能力,因此可以使用Katex或MathJax。 katex 似乎可以解决问题。我正在测试/尝试安装KATEX,并且可以选择在头部和JavaScript片段中注入代码(如下图所示)。
我的编程技能为零,我想知道是否有人做过或可以帮助我实现这一目标。对于头部部分,我放置了以下代码(它不起作用)。
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-ljao5I1l+8KYFXG7LNEA7DyaFvuvSCmedUf6Y6JI7LJqiu8q5dEivP2nDdFH31V4" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
可以找到Katex的文档在这里。
obs:circle.O可以选择插入自定义CSS(如果有帮助)
I am building an online community for IB Math students and for that I plan to use Circle.so. Circle.so seems like a great option given its features (like code injection) and design.
One of the features that the forum tool (such as Circle) needs to have is the ability to render Math notation (LaTeX) or allow code injection so KaTeX or MathJax can be used. KaTeX seems to solve the problem. I am testing/trying to install KaTeX and I have the options to inject code in the head and as a javascript snippet (as shown in the image below).

I have zero programming skills, I wonder if anyone has done it or could help me accomplish that. For the head portion, I placed the following code (it didn't work).
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-ljao5I1l+8KYFXG7LNEA7DyaFvuvSCmedUf6Y6JI7LJqiu8q5dEivP2nDdFH31V4" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
KaTeX's documentation can be found here.
Obs: Circle.so has the option to insert custom CSS (if that helps)
发布评论
评论(1)
这是一个2部分问题,一个非常容易。
问题1
解析Katex
这相对容易,
我们在页面上添加脚本和样式,并在我们的自定义脚本上选择和渲染文本。
还有一些JS渲染Katex字符串。
未解决的问题
我们不知道的
问题2
用户如何插入katex
这是一个充满挑战的一个,因为我们无法控制UI。但是,解决方法可能是使用工具栏中使用
代码
选项。Katex 和关键字只能是
katex
。因此,要使用KATEX,用户将在第一行中添加一个用katex
添加一个代码块,我们的JS将从那里添加。之前
scripts
工作片段
This is a 2 part problem, one pretty easy the other a bit harder.
Problem 1
Parsing KATEX
This is relatively easy,
We add the scripts and styles on the page and our custom script to select and render text.
And some JS to render KATEX strings.
Unresolved issues
We don't know...
Problem 2
How do users insert Katex
This is a challenging one coz we don't control the UI. However a workaround could be to use
Code
option from the toolbar.However we don't want to parse and potentially break all code blocks, but only specific ones, for this we could add in a key word to trigger
katex
and keyword can just bekatex
. So to use katex, users would add a code block withkatex
on first line and our JS will take it from there.Before scripts
After scripts
Working snippet