Mathup – A simple MathML authoring tool

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

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》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

图解网络硬件

图解网络硬件

[日] 三轮贤一 / 盛荣 / 人民邮电出版社 / 2014-7 / 69.00元

本书详细介绍了计算机网络硬件的相关知识,在对硬件设备、相关技术及规范进行详尽考据和整理的同时,侧重工程实践,重点讲述了在实际网络建设工程中真实使用的网络硬件设备及其相关背景知识,能够帮助读者深入理解计算机网络在工程实践中某些容易混淆的概念,如L3交换机和路由器等。 本书在讲解的同时,还辅以丰富的图例,使计算机网络设备的真实情况一目了然,同时深入浅出地介绍了原本复杂抽象的计算机网络术语,因此对......一起来看看 《图解网络硬件》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

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

RGB HEX 互转工具

URL 编码/解码
URL 编码/解码

URL 编码/解码