Skip to content

Commit

Permalink
Cleanup dist directory
Browse files Browse the repository at this point in the history
- Renamed `target/` to `dist/`
- Removed references to `mjs`
- Dropped support for node 12-16
- Migrated to jsdelivr from unpkg
  • Loading branch information
runarberg committed Nov 1, 2023
1 parent 9f36972 commit 68ed40b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 62 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.nyc_output
npm-debug.log
/dependencies.mjs
coverage/
node_modules/
target/
dist/
58 changes: 21 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mathup
======
# mathup

[![npm](https://img.shields.io/npm/v/mathup.svg)](https://www.npmjs.com/package/mathup)
[![License](https://img.shields.io/npm/l/mathup)](LICENSE)
Expand All @@ -8,9 +7,9 @@ mathup
[![Downloads](https://img.shields.io/npm/dm/mathup)](https://npm-stat.com/charts.html?package=mathup)
[![npms Score](https://badges.npms.io/mathup.svg)](https://api.npms.io/v2/package/mathup)

#### Installation ####
#### Installation

##### npm #####
##### npm

```bash
npm install mathup
Expand All @@ -20,9 +19,9 @@ npm install mathup
import mathup from "mathup";
```

##### Client #####
##### Client

Download one of the [released assets](https://github.com/runarberg/mathup/releases)
Download or link one or more of the [released assets](https://www.jsdelivr.com/package/npm/mathup?tab=files&path=dist)
and include the **module**:

```html
Expand All @@ -41,11 +40,11 @@ and include the **module**:
<script src="mathup.iife.js"></script>
```

#### Usage ####
#### Usage

```js
const expression = "1+1 = 2";
const options = {}; // optional
const options = {}; // optional
const mathml = mathup(expression, options);

mathml.toString();
Expand All @@ -58,22 +57,15 @@ const mathNode = mathml.toDOM();
mathup("3-2 = 1", { bare: true }).updateDOM(mathNode);
```


##### Custom Element #####
##### Custom Element

```html
<math-up
display="inline"
dir="ltr"
decimal-mark=","
col-sep=";"
row-sep=";;"
>
<math-up display="inline" dir="ltr" decimal-mark="," col-sep=";" row-sep=";;">
1+1 = 2
</math-up>
```

##### Command Line #####
##### Command Line

```bash
npm install -g mathup
Expand All @@ -84,8 +76,9 @@ mathup [options] -- <expression>
echo <expression> | mathup [options]
```

#### Options (with defaults) ####
#### Options (with defaults)

<!-- prettier-ignore -->
```js
const options = {
decimalMark: ".", // -m, --decimalmark="."
Expand All @@ -97,19 +90,16 @@ const options = {
}
```

Reference
---------
## Reference

[See here](http://runarberg.github.io/mathup/#reference)


Easy MathML authoring tool with a quick to write syntax
-------------------------------------------------------
## Easy MathML authoring tool with a quick to write syntax

This package exposes a single function `mathup` that intuitively takes
simple mathematical expressions—written in a markup language inspired
by [*AsciiMath*](http://asciimath.org/)—and outputs structured
[*MathML*](http://www.w3.org/Math/).
by [_AsciiMath_](http://asciimath.org/)—and outputs structured
[_MathML_](http://www.w3.org/Math/).

You can use it on the command line or on the server as an
[npm](https://npmjs.com) package, or in the browser by including the
Expand All @@ -120,11 +110,9 @@ there that does it for you. And you can choose what to do with the
output as well—piping it to another program, inject it streight to the
DOM, or just logging it to the console.

## Why not just use _MathJax_?

Why not just use *MathJax*?
---------------------------

[*MathJax*](http://www.mathjax.org/) is an excellent tool that you can
[_MathJax_](http://www.mathjax.org/) is an excellent tool that you can
safely use if all you want to do is include complex mathematical
expressions in a document. However, MathJax is a complex piece of
software that does a great deal more than just translate simple
Expand All @@ -134,16 +122,14 @@ faster (by doing less) then MathJax. While MathJax will search for
expressions, parse them, translate and render them. Mathup only parses
and translates them, and let the browser do the rendering.


Why AsciiMath / Why not TeΧ?
----------------------------
## Why AsciiMath / Why not TeΧ?

I wrote this tool, because I wanted to be able to author mathematical
expressions quickly, with no overhead (imagine `1/2` instead of
`\frac{1}{2}`). TeΧ expressions can easily become verbose and annoying
to write (especially on keyboards with complex access to the
<kbd> \ </kbd>, <kbd>{</kbd>, and <kbd>}</kbd> keys). However, the
purpose of this package is *not* to give people complete control over
purpose of this package is _not_ to give people complete control over
MathML in a non-verbose way, the purpose is to make it simple for
people to write simple expression. Of course I’ll try to give as much
expressive power as possible in the way, but I won’t promise to make
Expand All @@ -154,9 +140,7 @@ tags perhaps you should look for another tool. There are other great
efforts to enable people to author MathML in TeX format, take a look
at [TeXZilla](https://github.com/fred-wang/TeXZilla) for example.


Testing
-------
## Testing

Run the test suites with:

Expand Down
29 changes: 18 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="main.css" />

<script
src="https://unpkg.com/mathup/target/module/math-up-element.min.mjs"
src="https://cdn.jsdelivr.net/npm/mathup/dist/module/math-up-element.min.js"
type="module"
></script>
<script src="./use-example-element.js" type="module"></script>
Expand Down Expand Up @@ -152,56 +152,63 @@ <h5>Client</h5>
<ul>
<li>
Module (<a
href="https://cdn.jsdelivr.net/npm/mathup/target/module/mathup.mjs"
href="https://cdn.jsdelivr.net/npm/mathup/dist/module/mathup.js"
download
>full</a
>,
<a
href="https://cdn.jsdelivr.net/npm/mathup/target/module/mathup.min.mjs"
href="https://cdn.jsdelivr.net/npm/mathup/dist/module/mathup.min.js"
download
>min</a
>)
</li>

<li>
Script (<a
href="https://cdn.jsdelivr.net/npm/mathup/target/browser/mathup.iife.js"
href="https://cdn.jsdelivr.net/npm/mathup/dist/browser/mathup.iife.js"
download
>full</a
>,
<a
href="https://cdn.jsdelivr.net/npm/mathup/target/browser/mathup.iife.min.js"
href="https://cdn.jsdelivr.net/npm/mathup/dist/browser/mathup.iife.min.js"
download
>min</a
>)
</li>

<li>
Custom element as module (<a
href="https://cdn.jsdelivr.net/npm/mathup/target/module/math-up-element.mjs"
href="https://cdn.jsdelivr.net/npm/mathup/dist/module/math-up-element.js"
download
>full</a
>,
<a
href="https://cdn.jsdelivr.net/npm/mathup/target/module/math-up-element.min.mjs"
href="https://cdn.jsdelivr.net/npm/mathup/dist/module/math-up-element.min.js"
>min</a
>)
</li>

<li>
Custom element as script (<a
href="https://cdn.jsdelivr.net/npm/mathup/target/browser/math-up-element.iife.js"
href="https://cdn.jsdelivr.net/npm/mathup/dist/browser/math-up-element.iife.js"
download
>full</a
>,
<a
href="https://cdn.jsdelivr.net/npm/mathup/target/browser/math-up-element.iife.min.js"
href="https://cdn.jsdelivr.net/npm/mathup/dist/browser/math-up-element.iife.min.js"
download
>min</a
>)
</li>
</ul>

<p>…and include the <b>module</b>:</p>

<pre><code>&lt;<span class="hl-tag-name">script</span> <span class="hl-keyword">type</span>=<span class="hl-string">"module"</span> <span class="hl-keyword">src</span>=<span class="hl-string">"mathup.mjs"</span>&gt;&lt;/<span class="hl-tag-name">script</span>&gt;</code></pre>
<pre><code>&lt;<span class="hl-tag-name">script</span> <span class="hl-keyword">type</span>=<span class="hl-string">"module"</span> <span class="hl-keyword">src</span>=<span class="hl-string">"mathup.js"</span>&gt;&lt;/<span class="hl-tag-name">script</span>&gt;</code></pre>

<p>…the <b>custom element</b>:</p>

<pre><code>&lt;<span class="hl-tag-name">script</span> <span class="hl-keyword">type</span>=<span class="hl-string">"module"</span> <span class="hl-keyword">src</span>=<span class="hl-string">"math-up-element.mjs"</span>&gt;&lt;/<span class="hl-tag-name">script</span>&gt;</code></pre>
<pre><code>&lt;<span class="hl-tag-name">script</span> <span class="hl-keyword">type</span>=<span class="hl-string">"module"</span> <span class="hl-keyword">src</span>=<span class="hl-string">"math-up-element.js"</span>&gt;&lt;/<span class="hl-tag-name">script</span>&gt;</code></pre>

<p>…or the <b>script</b>:</p>

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"url": "https://github.com/runarberg/mathup.git"
},
"scripts": {
"clean": "rm -fr coverage/ target/",
"clean": "rm -fr coverage/ dist/",
"server": "python3 -m http.server",
"lint": "eslint --ext .js src/ test/ *.config.js",
"build": "rollup --config",
Expand All @@ -45,7 +45,7 @@
"@babel/preset-env",
{
"targets": {
"node": "12"
"node": "18"
}
}
]
Expand Down
18 changes: 9 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ const defaultConfig = {
input: "src/index.js",
output: [
{
file: `target/node/${NAME}.cjs`,
file: `dist/node/${NAME}.cjs`,
format: "cjs",
sourcemap: true,
},
{
file: `target/module/${NAME}.mjs`,
file: `dist/module/${NAME}.js`,
format: "module",
sourcemap: true,
},
{
file: `target/module/${NAME}.min.mjs`,
file: `dist/module/${NAME}.min.js`,
format: "module",
plugins: [terser()],
},
{
file: `target/browser/${NAME}.iife.js`,
file: `dist/browser/${NAME}.iife.js`,
format: "iife",
name: NAME,
banner: `/*! ${NAME} v${VERSION} | (c) 2015-${YEAR} (${LICENSE}) | ${HOMEPAGE} */`,
sourcemap: true,
},
{
file: `target/browser/${NAME}.iife.min.js`,
file: `dist/browser/${NAME}.iife.min.js`,
format: "iife",
name: NAME,
plugins: [terser()],
Expand All @@ -52,24 +52,24 @@ const customElementConfig = {
input: "src/custom-element.js",
output: [
{
file: `target/module/math-up-element.js`,
file: `dist/module/math-up-element.js`,
format: "module",
sourcemap: true,
},
{
file: `target/module/math-up-element.min.js`,
file: `dist/module/math-up-element.min.js`,
format: "module",
plugins: [terser()],
},
{
file: `target/browser/math-up-element.iife.js`,
file: `dist/browser/math-up-element.iife.js`,
format: "iife",
name: "MathUpElement",
banner: `/*! ${NAME} v${VERSION} | (c) 2015-${YEAR} (${LICENSE}) | ${HOMEPAGE} */`,
sourcemap: true,
},
{
file: `target/browser/math-up-element.iife.min.js`,
file: `dist/browser/math-up-element.iife.min.js`,
format: "iife",
name: "MathUpElement",
plugins: [terser()],
Expand Down

0 comments on commit 68ed40b

Please sign in to comment.