forked from mathquill/mathquill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close mathquill#563: Add "ultra-bare-bones" quickstart.html
In addition to being helpful to someone who just downloaded MathQuill for the first time, it makes it easy to sanity test release tarballs as packaged by `npm pack`. Considered putting it under test/, but it makes more sense in the root of a release package, and it's equally as helpful to someone who just `git clone`d MathQuill for the first time, so I think it's fine in the root of the repo.
- Loading branch information
1 parent
4e2a50f
commit 99c0a34
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>MathQuill Quickstart</title> | ||
<link rel="stylesheet" type="text/css" href="build/mathquill.css"> | ||
</head> | ||
<body> | ||
<p>Static math span: <span id="static-math">x = \frac{ -b \pm \sqrt{b^2-4ac} }{ 2a }</span> | ||
<p>Editable math field: <span id="math-field">x^2</span></p> | ||
<p>LaTeX of what you typed: <code id="latex">x^2</code></p> | ||
<p><a href="http://docs.mathquill.com/en/latest/Getting_Started/">MathQuill’s Getting | ||
Started Guide</a></p> | ||
|
||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js"></script> | ||
<script src="build/mathquill.js"></script> | ||
<script> | ||
var staticMathSpan = document.getElementById('static-math'); | ||
var mathFieldSpan = document.getElementById('math-field'); | ||
var latexSpan = document.getElementById('latex'); | ||
|
||
var MQ = MathQuill.getInterface(2); // keeps the API stable | ||
|
||
// easily create static or editable math from a DOM element by calling the | ||
// appropriate constructor: http://docs.mathquill.com/en/latest/Api_Methods/ | ||
MQ.StaticMath(staticMathSpan); | ||
|
||
// you may pass in an options object: | ||
var mathField = MQ.MathField(mathFieldSpan, { | ||
spaceBehavesLikeTab: true, // an example config option, for more see: | ||
// http://docs.mathquill.com/en/latest/Config/ | ||
handlers: { | ||
edit: function() { | ||
// retrieve, in LaTeX format, the math that was typed: | ||
latexSpan.textContent = mathField.latex(); | ||
} | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |