Skip to content

Commit

Permalink
Close mathquill#563: Add "ultra-bare-bones" quickstart.html
Browse files Browse the repository at this point in the history
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
laughinghan committed Jun 23, 2016
1 parent 4e2a50f commit 99c0a34
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"files": [
"build/mathquill.{css,js,min.js}",
"build/font/Symbola.*"
"build/font/Symbola.*",
"quickstart.html"
],
"devDependencies": {
"pjs": ">=3.1.0 <5.0.0",
Expand Down
40 changes: 40 additions & 0 deletions quickstart.html
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&rsquo;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>

0 comments on commit 99c0a34

Please sign in to comment.