@mathcrowd/mmarked 1.6.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,112 @@
1
+ ## [1.6.3](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.6.1...v1.6.3) (2024-09-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * npm install command fixed. ([b0bea6d](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/b0bea6d48eafa1dcd361fc6b01ad8db84c24b2ff))
7
+
8
+
9
+
10
+ ## [1.6.1](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.6.0...v1.6.1) (2024-09-20)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * demo page links fixed. ([9b40d38](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/9b40d38a572ac1dd3c3dfdd70ed28d8072ab54c0))
16
+
17
+
18
+
19
+ # [1.6.0](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.5.5...v1.6.0) (2024-09-20)
20
+
21
+
22
+ ### Features
23
+
24
+ * web integration supported. ([487f2cc](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/487f2cccc4489c13329ca7181408818f107b3eda))
25
+
26
+
27
+
28
+ ## [1.5.5](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.5.0...v1.5.5) (2024-09-18)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * github ci updated. ([7481f32](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/7481f32b5b1f4fe64cf4ffa95f1ac2dd5a0109ca))
34
+
35
+
36
+ ### Features
37
+
38
+ * support unnumbered theorem block. ([32cf3a0](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/32cf3a0f44dfa0cf3797a16b2f7bc9104775f413))
39
+
40
+
41
+
42
+ # [1.5.0](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.3.3...v1.5.0) (2024-09-04)
43
+
44
+
45
+
46
+ ## [1.3.3](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.3.2...v1.3.3) (2024-08-14)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * image size. [#7](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/issues/7) ([4bf2f68](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/4bf2f680d61cf8084a2be66e5709d46509b3a1a0))
52
+
53
+
54
+
55
+ ## [1.3.2](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.3.1...v1.3.2) (2024-08-08)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * add 'px' to image size. ([7aacb77](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/7aacb77512d418652e5e6b194fbb7278ce447c1d))
61
+
62
+
63
+
64
+ ## [1.3.1](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.2.2...v1.3.1) (2024-08-06)
65
+
66
+
67
+ ### Features
68
+
69
+ * image resizable. ([986e236](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/986e2362e404e03f1358ad9da2892493111c70f3))
70
+ * project reorgnized. ([2d4b437](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/2d4b4374e9451e0236e8d609c26f19ebcdf09872))
71
+ * rollup livereload / highlight added. ([4b893bf](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/4b893bf535165a61821d89c0e341d5820473710d))
72
+
73
+
74
+
75
+ ## [1.2.2](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.2.1...v1.2.2) (2024-08-01)
76
+
77
+
78
+
79
+ ## [1.2.1](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/v1.2.0...v1.2.1) (2024-08-01)
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * ts error https://github.com/markedjs/marked/issues/3101 ([1991650](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/1991650e64c513adb97bb4d31b12f3d0ae10a352))
85
+
86
+
87
+
88
+ # [1.2.0](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/compare/3d84e4de2829de5ae4f03efc51eadc9b279eb775...v1.2.0) (2024-08-01)
89
+
90
+
91
+ ### Bug Fixes
92
+
93
+ * demo page rollup ([4b52589](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/4b5258944d35b5dd962ead3c5fa3a129c897c0c8))
94
+ * footnote bug [#2](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/issues/2). ([6be6c7a](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/6be6c7a8b70be0dc75f9b342647ed99110655827))
95
+ * renderMarkdown/renderMarkdownCompact return value reorgnized. ([4a2df5f](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/4a2df5fa8fd092212cf0572a24f658f1d6147e77))
96
+ * use crypto and buffer in browser for demo. ([42fe470](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/42fe470f926049c88be5da33451a6eacd12b159d))
97
+
98
+
99
+ ### Features
100
+
101
+ * br rules ignored. ([f57bf7e](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/f57bf7e86fc67f277343ad9a9e11a5e3fff58359))
102
+ * demo added. ([6bb7b4e](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/6bb7b4ecd8339169c3c8d6ed8dd20bb2f87fe3a2))
103
+ * fig caption supported. ([325c093](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/325c093ade1036addc9dd2435b52e0e8ed11ed68))
104
+ * generate theorem/solution block classname. ([1a9ddac](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/1a9ddac0be4fa84f9a653362aada5cc6b66d4e51))
105
+ * handle error for tex2svg ([6a43864](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/6a43864a5b93a628da0e20352db27679702909a9))
106
+ * theorem rewrited. ([c7190d9](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/c7190d90329bfabe133eb467fd62f436e005c8ac))
107
+ * trigger updating dependencies. ([a0d167b](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/a0d167b6de42fdfd5f3eb712d24bf926af3ce650))
108
+ * upgrade marked.js to v13 ([af45a2f](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/af45a2f90f207069df23f0da65ff7dab31155e24))
109
+ * use section instead of div. ([3d84e4d](https://cloud.mathcrowd.cn:2444/agile/frontend/mathcrowd-marked-lib/commits/3d84e4de2829de5ae4f03efc51eadc9b279eb775))
110
+
111
+
112
+
package/COPYRIGHT.md ADDED
@@ -0,0 +1,11 @@
1
+ All Rights Reserved
2
+
3
+ Copyright © Mathcrowd 2016-2024 ([charles@mathcrowd.cn](mailto:charles@mathcrowd.cn))
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # mathcrowd-marked-lib
2
+
3
+ [![npm version](https://badge.fury.io/js/%40mathcrowd%2Fmmarked.svg)](https://badge.fury.io/js/%40mathcrowd%2Fmmarked)
4
+ [![License: Custom](https://img.shields.io/badge/License-Custom-yellow.svg)](https://opensource.org/licenses/)
5
+
6
+ A powerful TypeScript library for rendering customized markdown syntax with LaTeX support, designed for mathematical visualization in educational contexts.
7
+
8
+ ## 🌟 Features
9
+
10
+ - ✅ **Full CommonMark syntax support:** Comprehensive compatibility with CommonMark standards.
11
+ - 🔢 **Footnotes Blocks:** Supports rendering auto-numbered footnotes with easy reference links.
12
+ - 📘 **Theorem-like blocks:** Supports rendering mathematical theorems, lemmas, and examples in a block format with titles, auto-numbering, and reference links.
13
+ - 🖼️ **Image resizing capabilities:** Allows for customizable rendering of images and videos using simple syntax.
14
+ - 🔍 **Hidden/show solution blocks:** Provides a solution block with a toggle button for easy visibility control, implemented with straightforward syntax.
15
+ - 🧮 **TeX to SVG conversion:** Converts TeX equations to scalable vector graphics for high-quality rendering.
16
+ - 🔗 **Easy Integration with Existing Systems:** Supports both server-side and browser-side implementations for flexible use.
17
+
18
+ ## 🚀 Quick Start
19
+
20
+ ### Server Side Integration
21
+
22
+
23
+ #### Installation
24
+
25
+ ```bash
26
+ npm install @mathcrowd/mmarked mathjax-full highlight.js
27
+ ```
28
+
29
+ ### Basic Usage
30
+
31
+ ```typescript
32
+ import { tex2svg, renderMarkdown } from '@mathcrowd/mmarked'
33
+
34
+ // Convert TeX to SVG
35
+ const svg = tex2svg('$x^2$')
36
+
37
+ // Render Markdown to HTML
38
+ const html = renderMarkdown('### Heading').parsed
39
+ ```
40
+
41
+
42
+ ### Web Browser Side Integration
43
+
44
+ ```html
45
+ <!doctype html>
46
+ <html>
47
+
48
+ <head>
49
+ <meta charset="utf-8" />
50
+ <title>Marked in the browser</title>
51
+ </head>
52
+
53
+ <body>
54
+ <div id="content"></div>
55
+ <script src="dist/browser.umd.js"></script>
56
+ <script>
57
+ const { tex2svg, renderMarkdown } = marked
58
+ document.getElementById('content').innerHTML =
59
+ tex2svg(renderMarkdown('# Marked in the browser \n\n $x^2+y^2=1$ \n\nRendered by **mmarked**.').parsed);
60
+ console.log(renderMarkdown('# Marked in the browser\n\nRendered by **mmarked**.').lexed)
61
+ </script>
62
+ </body>
63
+
64
+ </html>
65
+ ```
66
+
67
+ ## 📚 API Reference
68
+
69
+ | Function | Description |
70
+ |----------|-------------|
71
+ | `tex2svg(tex: string): string` | Converts TeX to SVG in HTML format |
72
+ | `renderMarkdown(markdown: string): {parsed:string, lexed: Token[], time: number}` | Renders Markdown to HTML |
73
+ | `renderMarkdownCompact(markdown: string): {parsed:string, lexed: Token[], time: number}` | Renders Markdown to HTML without `<p>` tags |
74
+
75
+ ⚠️ **Important**: Always purify the output HTML using [DOMPurify](https://github.com/cure53/DOMPurify) to prevent XSS attacks.
76
+
77
+ ## 📖 Documentation
78
+
79
+ For detailed documentation in Chinese, visit our [Product Page](https://lab.mathcrowd.cn/markdown).
80
+
81
+ ## 🎮 Demo
82
+
83
+ Try out our interactive demo [here](https://mathedu4all.github.io/mathcrowd-marked-lib/demo/).
84
+
85
+ ## 👥 About Mathcrowd
86
+
87
+ Mathcrowd is an innovative startup founded by experienced independent developers and mathematics educators. We're on a mission to revolutionize math education in China through cutting-edge technology. Our goal is to create an engaging online community for math enthusiasts and self-learners, offering rich, interactive, and visualized learning content.
88
+
89
+ 🌐 MCLab Official Website: [https://lab.mathcrowd.cn](https://lab.mathcrowd.cn)
90
+
91
+ 🌐 Our Online Math Community: [https://www.mathcrowd.cn](https://www.mathcrowd.cn)
92
+
93
+ ## 📄 License
94
+
95
+ All Rights Reserved
96
+
97
+ Copyright © Mathcrowd 2016-2024 (charles@mathcrowd.cn)
98
+
99
+ ```
100
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
101
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
102
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
103
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
104
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
105
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
106
+ THE SOFTWARE.
107
+ ```
108
+
109
+ ## 🤝 Contributing
110
+
111
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more details.
112
+
113
+ ## 📞 Support
114
+
115
+ For any questions or issues, please [open an issue](https://github.com/mathedu4all/mathcrowd-marked-lib/issues) on our GitHub repository.
package/demo.html ADDED
@@ -0,0 +1,20 @@
1
+ <!doctype html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>Marked in the browser</title>
7
+ </head>
8
+
9
+ <body>
10
+ <div id="content"></div>
11
+ <script src="dist/browser.umd.js"></script>
12
+ <script>
13
+ const { tex2svg, renderMarkdown } = marked
14
+ document.getElementById('content').innerHTML =
15
+ tex2svg(renderMarkdown('# Marked in the browser \n\n $x^2+y^2=1$ \n\nRendered by **mathcrowd-marked-lib**.').parsed);
16
+ console.log(renderMarkdown('# Marked in the browser\n\nRendered by **marked**.').lexed)
17
+ </script>
18
+ </body>
19
+
20
+ </html>