Dec 11, 2024
0
Level 1
MathQuill
Hello, I want to ask whether the CDN used for Mathquill is correct?
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mathquill/0.10.1/mathquill.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathquill/0.10.1/mathquill.min.js"></script>
then I tried to display this data
"{\"question\":\"3\\\\times3\\\\div4+4x^2-6x^2=\",\"options\":[],\"question_image\":\"question_images\\/675a590317e01_baru.jpg\"}]"
produces a display like this
3times3div4+4x^2-6x^2=
I process it like this
<span class="math-question-display" id="math-display-{{ $question->id }}">{!! stripslashes($q['question']) !!}</span>
document.addEventListener('DOMContentLoaded', function () {
const MQ = MathQuill.getInterface(2);
document.querySelectorAll('.math-question-display').forEach(function (element) {
let latex = element.textContent.trim();
MQ.StaticMath(element).latex(latex);
});
});
I thank you for your help
Please or to participate in this conversation.