@difizen/libro-markdown 0.2.0 → 0.2.2
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/es/markdown-render.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import MarkdownIt from 'markdown-it';
|
|
2
2
|
import type { MarkdownRenderOption } from './markdown-protocol.js';
|
|
3
3
|
import { MarkdownParser } from './markdown-protocol.js';
|
|
4
|
+
import 'katex/dist/katex.min.css';
|
|
4
5
|
export declare class MarkdownRender implements MarkdownParser {
|
|
5
6
|
protected mkt: MarkdownIt;
|
|
6
7
|
slugify: (s: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-render.d.ts","sourceRoot":"","sources":["../src/markdown-render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown-render.d.ts","sourceRoot":"","sources":["../src/markdown-render.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,0BAA0B,CAAC;AAElC,qBACa,cAAe,YAAW,cAAc;IACnD,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC;IAC1B,OAAO,wBAAW;IAClB,eAAe,UAAS;IAGxB,IAAI;IAcJ,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM;CAIrE"}
|
package/es/markdown-render.js
CHANGED
|
@@ -7,9 +7,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
9
9
|
import { postConstruct, singleton } from '@difizen/mana-app';
|
|
10
|
+
import latexPlugin from '@traptitech/markdown-it-katex';
|
|
10
11
|
import MarkdownIt from 'markdown-it';
|
|
11
12
|
import { libroAnchor, linkInsideHeader, slugify } from "./anchor.js";
|
|
12
13
|
import { MarkdownParser } from "./markdown-protocol.js";
|
|
14
|
+
import 'katex/dist/katex.min.css';
|
|
13
15
|
export var MarkdownRender = (_dec = singleton({
|
|
14
16
|
token: MarkdownParser
|
|
15
17
|
}), _dec2 = postConstruct(), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
@@ -36,6 +38,7 @@ export var MarkdownRender = (_dec = singleton({
|
|
|
36
38
|
permalink: this.enablePermalink ? linkInsideHeader : false,
|
|
37
39
|
slugify: this.slugify
|
|
38
40
|
});
|
|
41
|
+
this.mkt.use(latexPlugin);
|
|
39
42
|
}
|
|
40
43
|
}, {
|
|
41
44
|
key: "render",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-markdown",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@difizen/mana-app": "latest",
|
|
37
|
+
"@traptitech/markdown-it-katex": "^3.6.0",
|
|
37
38
|
"@types/markdown-it": "^12.2.3",
|
|
39
|
+
"katex": "^0.16.10",
|
|
38
40
|
"markdown-it": "^13.0.1",
|
|
39
41
|
"markdown-it-anchor": "^8.6.5"
|
|
40
42
|
},
|
package/src/markdown-render.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { postConstruct, singleton } from '@difizen/mana-app';
|
|
2
|
+
import latexPlugin from '@traptitech/markdown-it-katex';
|
|
2
3
|
import MarkdownIt from 'markdown-it';
|
|
3
4
|
|
|
4
5
|
import { libroAnchor, linkInsideHeader, slugify } from './anchor.js';
|
|
5
6
|
import type { MarkdownRenderOption } from './markdown-protocol.js';
|
|
6
7
|
import { MarkdownParser } from './markdown-protocol.js';
|
|
8
|
+
import 'katex/dist/katex.min.css';
|
|
7
9
|
|
|
8
10
|
@singleton({ token: MarkdownParser })
|
|
9
11
|
export class MarkdownRender implements MarkdownParser {
|
|
@@ -23,6 +25,7 @@ export class MarkdownRender implements MarkdownParser {
|
|
|
23
25
|
permalink: this.enablePermalink ? linkInsideHeader : false,
|
|
24
26
|
slugify: this.slugify,
|
|
25
27
|
});
|
|
28
|
+
this.mkt.use(latexPlugin);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
render(markdownText: string, options?: MarkdownRenderOption): string {
|