@webc.site/math 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,11 +21,11 @@ The world's smallest and fastest web Markdown formula renderer designed to parse
21
21
  - [What is MathML?](#what-is-mathml)
22
22
  - [Why Compile TeX Formulas to MathML?](#why-compile-tex-formulas-to-mathml)
23
23
  - [Benchmark](#benchmark)
24
- - [Design & Calling Process](#design--calling-process)
24
+ - [Design and Calling Process](#design-and-calling-process)
25
25
  - [How to Add Syntax Support](#how-to-add-syntax-support)
26
26
  - [Tech Stack](#tech-stack)
27
27
  - [Directory Structure](#directory-structure)
28
- - [History & Background](#history--background)
28
+ - [History and Background](#history-and-background)
29
29
 
30
30
  ## Usage
31
31
 
@@ -56,7 +56,7 @@ const tex = "e^{i\\pi} + 1 = 0";
56
56
  const html = mathml(tex, true); // true for block math, false/empty for inline math
57
57
  ```
58
58
 
59
- ### CSS & Math Font Configuration
59
+ ### CSS and Math Font Configuration
60
60
 
61
61
  For browser mathematical layout engines to present beautifully typeset math equations, we highly recommend using a math font. The **Latin Modern Math** font provided in the `18s` package is recommended (derived from Knuth's classical Computer Modern typeface, with a complete mathematical symbol set and OpenType MATH table support).
62
62
 
@@ -208,7 +208,7 @@ Currently, the following LaTeX extensions, macro definitions, or custom styling
208
208
  8. **Equation Numbering & Custom Tags**: `\tag`, `\newtagform`, `\usetagform`, etc.
209
209
  9. **Arbitrary Operator Limits**: Except for predefined big operators (`\sum`, `\int`) and limit-like operators (`\lim`), using `\limits` on arbitrary commands or structures (e.g., `\operatorname{sn}\limits_{...}`) is not supported.
210
210
 
211
- ## Error Handling & Fault Tolerance
211
+ ## Error Handling and Fault Tolerance
212
212
 
213
213
  When parsing Markdown text using `@webc.site/math/md`, if a mathematical formula contains invalid LaTeX syntax (such as an unclosed `\left`), the parser automatically catches the compilation error internally and gracefully falls back to displaying the raw formula text (e.g., `$$x + \left( y$$`). This ensures that a single syntax error in a formula won't throw JavaScript exceptions or crash your application. Therefore, you **do not** need to wrap it in a `try...catch` block when calling this function.
214
214
 
@@ -252,7 +252,7 @@ Our compiler acts as a translator that turns TeX into standard MathML tags on th
252
252
 
253
253
  Because the compilation is purely a fast tag-mapping step and layout is handled natively, CPU usage is minimal. This makes it ideal for **WYSIWYG editors, live markdown previewers, and interactive apps** where formulas need to be rendered dynamically on every keystroke without lag—even on low-end mobile devices.
254
254
 
255
- #### 4. Unified Frontend & SSR Capabilities
255
+ #### 4. Unified Frontend and SSR Capabilities
256
256
 
257
257
  Since the output is standard HTML with MathML elements, the same compiler works seamlessly for dynamic client-side rendering (CSR), server-side rendering (SSR), and static site generation (SSG) alike.
258
258
 
@@ -280,7 +280,7 @@ Based on compiling standard test equations (measured using [sh/benchmark.js](htt
280
280
 
281
281
  ![](demo/speed.svg)
282
282
 
283
- ## Design & Calling Process
283
+ ## Design and Calling Process
284
284
 
285
285
  The parser processes input Markdown string, isolates TeX expressions, and translates them to MathML structures.
286
286
 
@@ -378,7 +378,7 @@ The `SHOW_MAP` dictionary converts AST nodes into standard MathML markup strings
378
378
  └── test.sh # Formatter, linter, and compiler test runner
379
379
  ```
380
380
 
381
- ## History & Background
381
+ ## History and Background
382
382
 
383
383
  Mathematical typesetting on the web has historically relied on heavy libraries like MathJax or KaTeX. These libraries fetch large bundles and execute extensive CSS and layout calculations, causing page loading latencies.
384
384
 
@@ -404,8 +404,8 @@ The `18s` project provides a optimized math font `m` (Latin Modern Math, derived
404
404
  - [使用方法](#使用方法)
405
405
  - [功能特性](#功能特性)
406
406
  - [支持的语法清单](#支持的语法清单)
407
- - [什么是 MathML?](#什么是-mathml)
408
- - [为什么需要 TeX 公式转 MathML?](#为什么需要-tex-公式转-mathml)
407
+ - [什么是 MathML?](#什么是-mathml)
408
+ - [为什么需要 TeX 公式转 MathML?](#为什么需要-tex-公式转-mathml)
409
409
  - [性能对比](#性能对比)
410
410
  - [设计思路与调用流程](#设计思路与调用流程)
411
411
  - [如何添加新的语法支持](#如何添加新的语法支持)
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@webc.site/math","version":"0.1.2","description":"The world's smallest and fastest web Markdown formula renderer / 全球最小最快的网页Markdown公式渲染器","keywords":["markdown","math","mathml","render","tex"],"homepage":"https://math.webc.site","license":"MulanPSL-2.0","author":"i18n.site@gmail.com","repository":{"type":"git","url":"git+https://github.com/webc-site/math.git"},"type":"module","exports":{".":"./mathml.js","./*":"./*"},"scripts":{"prepare":"husky"},"dependencies":{},"lint-staged":{"**/*.svg":"bun sh/hook/svg.js","**/*.styl":"bun sh/hook/styl.js"}}
1
+ {"name":"@webc.site/math","version":"0.1.3","description":"The world's smallest and fastest web Markdown formula renderer / 全球最小最快的网页Markdown公式渲染器","keywords":["markdown","math","mathml","render","tex"],"homepage":"https://math.webc.site","license":"MulanPSL-2.0","author":"i18n.site@gmail.com","repository":{"type":"git","url":"git+https://github.com/webc-site/math.git"},"type":"module","exports":{".":"./mathml.js","./*":"./*"},"scripts":{"prepare":"husky"},"dependencies":{},"lint-staged":{"**/*.svg":"bun sh/hook/svg.js","**/*.styl":"bun sh/hook/styl.js"}}