mathup v1.0.0-alpha.2
Pre-release
Pre-release
Language Changes
- Meaningful identifiers and operators cannot immedietly follow—or be followed by—an alphabetic character. E.g.
asinb
will not combine thesin
into a single identifier. Surround the identifier with spaces to get the desired result. E.g.a sin b
, or—better yet—use invisible (zero width) operators (U+2061–U+2064;a&*sin&$b
; see below). - Infixes (e.g.
/
,^
, or_
) now follow a consistent grammar. It will operate on the previous/next literal if it immediately presides/follows (e.g. no space between), otherwise it will operate on the previous/next expression (i.e. terms grouped together by surrounding space/parens/other infixes). - Font commands now work on the following expression, as opposed to just following token elements. E.g. now its possible to do
bf [a; b]
to make all the terms of the matrix bold-face. - Bevelled fractions (
a./b
) have been removed. They are deprecated in MathML and might be removed from browsers soon. Usea//b
instead for a fraction slash operator. - Removed nested bracket matrix notation:
[(a, b), (c, d)]
. Use column seperators or newlines for writing matrices:[a, b; c, d]
. - pipe fences and matrices (
|a,b;c,d|
and||a,b;c,d||
) now require inner parenthesis (|(a,b;c,d)|
and||(a,b;c,d)||
respectively). - Unicode numbers are now strictly (with one expection) in the Nd, Nl, and No unicode categories. The only exceptions are the dozenal
U+218A ↊ TURNED DIGIT TWO
andU+218B ↋ TURNED DIGIT THREE
. This omits CJK numerals (like 二, 四, or 万) that were previously mapped to number literals. Prepend then with octothorpe (#四十二
) if you want the old behavior. - Backslash operators in brackets
\(foo)
,\[bar]
have been removed. Instead they follow the same syntax as octothorpe numbers. Write\int
for alphanumeric operators, or\`foo bar`
if they contain symbols. If you need to use a backtick as an operator then the fencing follows the same syntax as markdown.\`` ` ``
. The same goes for octothorpe numbers#`forty two`
, identifiers`foo bar`
, and text"" "in quotes" ""
. - Roots are now notated as taking two args (just like
binom
). writeroot(a, b)
orroot a b
. Unlike previous versionsroot(a)(b)
will now include the brackets arounda
andb
.
Output Changes
- Fenced groups will no long render in the deprecated
<mfenced>
element. Instead it renders in the visually equivalent<mrow>
s with<mo>
s as fences and seperators. lim
andmod
now map to opperators and render in an<mo>
element.
Additions
- Added
.toString()
and.toDOM()
methods to the returned object. - Added
obrace
andubrace
to accents. - Added invisible operators
&+
,&*
,&,
, and&$
for implied addition, multiplication, seperation and function application respectively.
Breaking Changes
- Removed the following opitons from the main function—they might be reimplented if demand is there:
annotate
bare
standalone
- Calling main function with a single option parameter no longer returns another main function with those options applied. If you want to curry the main function, use an arrow function or a library:
const curried = input => mathup(input, { display: "block" })
- Main function no longer returns string by default. Use the
.toString()
method of the returned object instead.