MathType 모듈(MathType Integrations)은 WIRIS에서 제공하는 웹 수식 입력기(MathType Web)를 웹사이트에 쉽게 통합할 수 있게 해주는 라이브러리입니다. WIRIS는 MathType의 제작사이며, 이들은 MathType을 HTML에서 사용할 수 있도록 WIRIS Editor라는 JavaScript 기반의 플러그인을 제공합니다.
아래는 MathType / WIRIS 수식 입력기를 HTML 페이지에 통합하는 아주 기본적인 예제 코드입니다.
✅ MathType(WIRIS) 수식 입력기 구현 예제 (HTML + JS)
1. 필수 CDN 링크 포함
먼저 웹 페이지에 MathType by WIRIS의 스크립트 및 스타일시트를 추가해야 합니다.
<!-- MathType Plugin by WIRIS -->
<script src="https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image" type="text/javascript"></script>
2. 수식 입력 영역 추가
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>MathType 수식 입력기</title>
<script src="https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image" type="text/javascript"></script>
<style>
#editor {
width: 100%;
min-height: 150px;
border: 1px solid #ccc;
padding: 10px;
}
</style>
</head>
<body>
<h2>MathType 수식 입력기</h2>
<!-- 수식 입력기 영역 -->
<div id="editor" contenteditable="true" class="wiriscomponent wysiwyg">
여기에 수식을 입력하거나 수식 도구를 사용하세요.
</div>
<br>
<button onclick="getMathML()">👉 수식 코드 가져오기</button>
<h3>📄 MathML 출력:</h3>
<div id="output" style="white-space: pre-wrap; border: 1px solid #ddd; padding: 10px;"></div>
<script>
function getMathML() {
const editor = document.getElementById('editor');
const mathML = window.WIRISplugins.Parser.getMathML(editor);
document.getElementById("output").textContent = mathML;
}
</script>
</body>
</html>
✅ 기능 설명
- 위 코드는 WIRIS(MathiType) Editor를 통해 HTML에서 수식을 입력할 수 있게 해주는 간단한 예제입니다.
contenteditable="true"인 <div>가 수식 에디터로 동작합니다.
- 사용자는 수식 버튼을 눌러 수식을 입력할 수 있습니다.
- 버튼을 클릭하면 수식을 MathML 코드로 추출해 아래 출력 창에 보여줍니다.
⭐ 추가 기능 및 팁
❗ 주의사항
- 위 링크
https://www.wiris.net/demo는 데모 버전용 CDN입니다.
- 상용 웹사이트나 LMS에 통합하려면 WIRIS에서 라이선스를 받아 정식 버전 URL을 사용해야 합니다.
필요하다면 React, Vue, 또는 에디터(CKEditor, TinyMCE, Froala 등) 연동 예제도 제공해 드릴 수 있습니다.
원하는 방식 있으신가요?