0.0.8 • Published 10 months ago

@evyu/latex-editor v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Latex-Editor

this is a latex editor package, it provide some help with writing math formula even if you don't understand latex.

demo

demo image

Getting started

  1. Install

    npm install @evyu/latex-editor

    or

    yarn add @evyu/latex-editor
  2. Load the latex-editor libary

    <head>
      <link rel="stylesheet" href="./style.css" />
      <script src="./@evyu/latex-editor/index.umd.js"></script>
    </head>

    or

    import LatexEditor from '@evyu/latex-editor'
  3. Add a <div></div> tag. this tag is the initial of editor

    <div class="my-editor"></div>
  4. Init the latex editor: new LatexEditor(ele:HTMLElement, options: Object)

    参数类型是否必传默认值
    eleHTMLElement
    contentString
    optionObject详见 option
    new LatexEditor(document.querySelector('.my-editor'), {
      content: '\\angleABC=90\\circ',
    })

Options

参数类型是否必传默认值说明
lineBreakBooleantrue换行
lineHeightString'20px'行高
textColorString'#333'文字颜色
divideChineseBooleanfalse将中文从 latex 中拆分出来
wrapMathrmBooleantrue去除罗马字体