Mathup – A simple MathML authoring tool

栏目: IT技术 · 发布时间: 6年前

Installation

npm

npm install mathup
import mathup from "mathup";

Client

Download one of the following:

…and include the module :

<script type="module" src="mathup.mjs"></script>

…the custom element :

<script type="module" src="math-up-element.mjs"></script>

…or the script :

<script src="mathup.iife.js"></script>

Usage

const expression = "1+1 = 2";

const options = {};  // optional

const mathml = mathup(expression, options);


mathml.toString();

// => "<math><mrow><mn>1</mn><mo>+</mo><mn>1</mn></mrow><mo>=</mo><mn>2</mn></math>"


const mathNode = mathml.toDOM();

// => [object MathMLElement]


// Update existing <math> node in place

mathup("3-2 = 1", { bare: true }).updateDOM(mathNode);

Custom Element

<math-up

  display="inline"

  dir="ltr"

  decimal-mark=","

  col-sep=";"

  row-sep=";;"

>

  1+1 = 2

</math-up>

Command line

npm install -g mathup

mathup [options] -- <expression>


# or from stdin

echo <expression> | mathup [options]

Options (with defaults)

const options = {

  decimalMark: ".",   
// -m  --decimal-mark="."

  colSep: ",",        
// -c  --col-sep=","

  rowSep: ";",        
// -r  --row-sep=";"

  display: "inline",  
// -d  --display="inline"

  dir: "ltr",         
//     --rtl

  bare: false,        
// -b  --bare

};

Note:If you pick , as your decimal mark then ; becomes the new default column separator. And if ; is your column separator then the new default row separator becomes ;; . You can use , as both a decimal mark and a row separator if you take care to add a space between the row separator and the following digit. However then you must set both explicitly.

const options = {

  decimalMark: ",",

  colSep: ",",

};

以上所述就是小编给大家介绍的《Mathup – A simple MathML authoring tool》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

高性能MySQL

高性能MySQL

施瓦茨 (Baron Schwartz)、扎伊采夫 (Peter Zaitsev)、特卡琴科 (Vadim Tkachenko) / 宁海元、周振兴、彭立勋、翟卫祥,刘辉 / 电子工业出版社 / 2013-5-1 / 128.00元

《高性能mysql(第3版)》是mysql 领域的经典之作,拥有广泛的影响力。第3 版更新了大量的内容,不但涵盖了最新mysql 5.5版本的新特性,也讲述了关于固态盘、高可扩展性设计和云计算环境下的数据库相关的新内容,原有的基准测试和性能优化部分也做了大量的扩展和补充。全书共分为16 章和6 个附录,内容涵盖mysql 架构和历史,基准测试和性能剖析,数据库软硬件性能优化,复制、备份和恢复,高可......一起来看看 《高性能MySQL》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器