@mathcrowd/mmarked 3.1.3 → 3.1.4

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [3.1.4](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v3.1.3...v3.1.4) (2026-04-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * exclude .map files from npm package ([69a9436](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/69a9436b8742972cd10a8f9314092590b3fdddb8))
7
+ * prevent trigger-update race condition by fetching existing update-dependencies branch ([e3f0826](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/e3f0826f7a03e7ac2bc5af0a6e370beebb1a7f6f))
8
+ * rebase update-dependencies branch on main before updating ([a6709bb](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/a6709bbbd90362b6e8be302edf48aefcd4a359e5))
9
+ * upgrade trigger-update to semver-aware strategy and add release script ([3c0a5b2](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/3c0a5b257c354969040f5e07b995195a77d2ec07))
10
+
11
+
12
+ ### Features
13
+
14
+ * add i18n locale support for built-in labels (zh/en) ([4bb0bf9](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/4bb0bf99f647ced1e6340a9c7ba672df412a0d2f))
15
+
1
16
  ## [3.1.3](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v3.1.2...v3.1.3) (2026-03-27)
2
17
 
3
18
  ## [3.1.2](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v3.1.1...v3.1.2) (2026-03-23)
package/README.md CHANGED
@@ -25,6 +25,7 @@ Transform your Markdown experience with **mmarked** - a powerful TypeScript libr
25
25
  ### Core Capabilities
26
26
 
27
27
  - ✅ **Full CommonMark Support** - Complete compatibility with standard Markdown syntax
28
+ - 🌐 **I18n Support** - Built-in Chinese/English locale for theorem, proof, footnote labels
28
29
  - 🔗 **Easy Integration** - Works seamlessly in Node.js and browser environments
29
30
  - 📦 **Lightweight Core** - Minimal dependencies, extensible architecture
30
31
  - ⚡ **High Performance** - Optimized rendering pipeline for fast output
@@ -77,6 +78,10 @@ This fundamental theorem (see [~pythagoras]) relates the sides of right triangle
77
78
 
78
79
  console.log(result.parsed) // HTML output
79
80
  console.log(result.time) // Rendering time in ms
81
+
82
+ // Render with English locale
83
+ const enResult = renderMarkdown(`...`, { locale: 'en' })
84
+ // Theorem → "Theorem", Proof → "Proof", Footnotes → "Footnotes"
80
85
  ```
81
86
 
82
87
  ### License Configuration (Node.js Only)
@@ -234,12 +239,16 @@ configureLicense({
234
239
 
235
240
  ### Core Functions
236
241
 
237
- #### `renderMarkdown(markdown: string)`
242
+ #### `renderMarkdown(markdown: string, options?: { locale?: Locale })`
238
243
 
239
244
  Renders Markdown to HTML with full feature support.
240
245
 
241
246
  **License:** Requires valid license for commercial use in Node.js. Free in browsers.
242
247
 
248
+ **Parameters:**
249
+ - `markdown`: Markdown source string
250
+ - `options.locale`: `'zh'` (default) or `'en'` — controls built-in labels for theorem-like blocks, solution/proof blocks, and footnote headings
251
+
243
252
  **Returns:**
244
253
  ```typescript
245
254
  {
@@ -249,10 +258,27 @@ Renders Markdown to HTML with full feature support.
249
258
  }
250
259
  ```
251
260
 
261
+ **Locale mapping:**
262
+
263
+ | Keyword | `zh` (default) | `en` |
264
+ |---------|---------------|------|
265
+ | `theorem` | 定理 | Theorem |
266
+ | `lemma` | 引理 | Lemma |
267
+ | `corollary` | 推论 | Corollary |
268
+ | `axiom` | 公理 | Axiom |
269
+ | `definition` | 定义 | Definition |
270
+ | `example` | 例 | Example |
271
+ | `proof` | 证明 | Proof |
272
+ | `solution` | 解答 | Solution |
273
+ | Footnote heading | 脚注 | Footnotes |
274
+
252
275
  **Example:**
253
276
  ```typescript
254
277
  const { parsed, time } = renderMarkdown('# Hello $x^2$')
255
278
  console.log(`Rendered in ${time}ms`)
279
+
280
+ // English locale
281
+ const { parsed: enHtml } = renderMarkdown(md, { locale: 'en' })
256
282
  ```
257
283
 
258
284
  #### `renderMarkdownCompact(markdown: string)`
package/README.zh.md CHANGED
@@ -25,6 +25,7 @@
25
25
  ### 核心能力
26
26
 
27
27
  - ✅ **完整 CommonMark 支持** - 与标准 Markdown 语法完全兼容
28
+ - 🌐 **多语言支持** - 内置中英文 locale,定理、证明、脚注等标签自动切换
28
29
  - 🔗 **轻松集成** - 在 Node.js 和浏览器环境中无缝运行
29
30
  - 📦 **轻量核心** - 最少依赖,可扩展架构
30
31
  - ⚡ **高性能** - 优化的渲染管道,输出快速
@@ -77,6 +78,10 @@ $$a^2 + b^2 = c^2$$
77
78
 
78
79
  console.log(result.parsed) // HTML 输出
79
80
  console.log(result.time) // 渲染耗时(毫秒)
81
+
82
+ // 使用英文 locale 渲染
83
+ const enResult = renderMarkdown(`...`, { locale: 'en' })
84
+ // 定理 → "Theorem",证明 → "Proof",脚注 → "Footnotes"
80
85
  ```
81
86
 
82
87
  ### 许可证配置(仅 Node.js)
@@ -234,12 +239,16 @@ configureLicense({
234
239
 
235
240
  ### 核心函数
236
241
 
237
- #### `renderMarkdown(markdown: string)`
242
+ #### `renderMarkdown(markdown: string, options?: { locale?: Locale })`
238
243
 
239
244
  将 Markdown 渲染为 HTML,支持所有功能。
240
245
 
241
246
  **许可证:** Node.js 商业使用需要有效许可证。浏览器免费使用。
242
247
 
248
+ **参数:**
249
+ - `markdown`:Markdown 源字符串
250
+ - `options.locale`:`'zh'`(默认)或 `'en'` —— 控制定理类块、证明/解答块、脚注标题的内置标签语言
251
+
243
252
  **返回值:**
244
253
  ```typescript
245
254
  {
@@ -249,10 +258,27 @@ configureLicense({
249
258
  }
250
259
  ```
251
260
 
261
+ **Locale 对照表:**
262
+
263
+ | 关键字 | `zh`(默认) | `en` |
264
+ |--------|-------------|------|
265
+ | `theorem` | 定理 | Theorem |
266
+ | `lemma` | 引理 | Lemma |
267
+ | `corollary` | 推论 | Corollary |
268
+ | `axiom` | 公理 | Axiom |
269
+ | `definition` | 定义 | Definition |
270
+ | `example` | 例 | Example |
271
+ | `proof` | 证明 | Proof |
272
+ | `solution` | 解答 | Solution |
273
+ | 脚注标题 | 脚注 | Footnotes |
274
+
252
275
  **示例:**
253
276
  ```typescript
254
277
  const { parsed, time } = renderMarkdown('# 你好 $x^2$')
255
278
  console.log(`渲染耗时 ${time}ms`)
279
+
280
+ // 英文 locale
281
+ const { parsed: enHtml } = renderMarkdown(md, { locale: 'en' })
256
282
  ```
257
283
 
258
284
  #### `renderMarkdownCompact(markdown: string)`