@erudit-js/prose 3.0.0-dev.25
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/dist/app/appElement.d.ts +19 -0
- package/dist/app/appElement.js +12 -0
- package/dist/app/component.d.ts +6 -0
- package/dist/app/component.js +6 -0
- package/dist/app/composables/anchor.d.ts +16 -0
- package/dist/app/composables/anchor.js +89 -0
- package/dist/app/composables/appElement.d.ts +4 -0
- package/dist/app/composables/appElement.js +16 -0
- package/dist/app/composables/context.d.ts +22 -0
- package/dist/app/composables/context.js +5 -0
- package/dist/app/composables/elementIcon.d.ts +3 -0
- package/dist/app/composables/elementIcon.js +5 -0
- package/dist/app/composables/formatText.d.ts +1 -0
- package/dist/app/composables/formatText.js +5 -0
- package/dist/app/composables/language.d.ts +8 -0
- package/dist/app/composables/language.js +13 -0
- package/dist/app/composables/storage.d.ts +5 -0
- package/dist/app/composables/storage.js +23 -0
- package/dist/app/default/Inliners.vue +11 -0
- package/dist/app/default/Mix.vue +11 -0
- package/dist/app/default/Text.vue +21 -0
- package/dist/app/icon.d.ts +5 -0
- package/dist/app/icon.js +7 -0
- package/dist/app/index.d.ts +18 -0
- package/dist/app/index.js +18 -0
- package/dist/app/language/element.d.ts +10 -0
- package/dist/app/language/element.js +12 -0
- package/dist/app/language/list/en.d.ts +3 -0
- package/dist/app/language/list/en.js +5 -0
- package/dist/app/language/list/ru.d.ts +3 -0
- package/dist/app/language/list/ru.js +5 -0
- package/dist/app/language/prose.d.ts +9 -0
- package/dist/app/language/prose.js +4 -0
- package/dist/app/shared/Prose.vue +36 -0
- package/dist/app/shared/Render.vue +51 -0
- package/dist/app/shared/assets/block.svg +3 -0
- package/dist/app/shared/assets/check.svg +3 -0
- package/dist/app/shared/assets/inliner.svg +3 -0
- package/dist/app/shared/assets/plus.svg +3 -0
- package/dist/app/shared/assets/share.svg +3 -0
- package/dist/app/shared/block/AsideMenu.vue +44 -0
- package/dist/app/shared/block/AsideMenuButton.vue +53 -0
- package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -0
- package/dist/app/shared/block/AsideMenuSeparator.vue +3 -0
- package/dist/app/shared/block/Block.vue +270 -0
- package/dist/app/shared/inliner/Inliner.vue +11 -0
- package/dist/app/shared/invert.d.ts +2 -0
- package/dist/app/shared/invert.js +2 -0
- package/dist/app/shared/photoswipe/composable.d.ts +9 -0
- package/dist/app/shared/photoswipe/composable.js +68 -0
- package/dist/app/shared/photoswipe/style.css +26 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.js +1 -0
- package/dist/coreElement.d.ts +10 -0
- package/dist/coreElement.js +6 -0
- package/dist/elements/accent/Accent.vue +92 -0
- package/dist/elements/accent/AccentColumnSection.vue +61 -0
- package/dist/elements/accent/AccentRowSections.vue +65 -0
- package/dist/elements/accent/app.d.ts +21 -0
- package/dist/elements/accent/app.js +16 -0
- package/dist/elements/accent/core.d.ts +340 -0
- package/dist/elements/accent/core.js +175 -0
- package/dist/elements/callout/Callout.vue +88 -0
- package/dist/elements/callout/_global.d.ts +15 -0
- package/dist/elements/callout/app.d.ts +9 -0
- package/dist/elements/callout/app.js +11 -0
- package/dist/elements/callout/core.d.ts +80 -0
- package/dist/elements/callout/core.js +37 -0
- package/dist/elements/callout/icon.svg +3 -0
- package/dist/elements/callout/languages/en.d.ts +4 -0
- package/dist/elements/callout/languages/en.js +2 -0
- package/dist/elements/callout/languages/ru.d.ts +4 -0
- package/dist/elements/callout/languages/ru.js +2 -0
- package/dist/elements/callout/storage.d.ts +2 -0
- package/dist/elements/callout/storage.js +5 -0
- package/dist/elements/caption/Caption.vue +47 -0
- package/dist/elements/caption/_global.d.ts +26 -0
- package/dist/elements/caption/app.d.ts +9 -0
- package/dist/elements/caption/app.js +6 -0
- package/dist/elements/caption/core.d.ts +114 -0
- package/dist/elements/caption/core.js +61 -0
- package/dist/elements/details/Details.vue +51 -0
- package/dist/elements/details/_global.d.ts +27 -0
- package/dist/elements/details/app.d.ts +9 -0
- package/dist/elements/details/app.js +11 -0
- package/dist/elements/details/core.d.ts +68 -0
- package/dist/elements/details/core.js +30 -0
- package/dist/elements/details/icon.svg +3 -0
- package/dist/elements/details/languages/en.d.ts +4 -0
- package/dist/elements/details/languages/en.js +2 -0
- package/dist/elements/details/languages/ru.d.ts +4 -0
- package/dist/elements/details/languages/ru.js +2 -0
- package/dist/elements/diagram/Diagram.vue +364 -0
- package/dist/elements/diagram/_global.d.ts +19 -0
- package/dist/elements/diagram/app.d.ts +30 -0
- package/dist/elements/diagram/app.js +11 -0
- package/dist/elements/diagram/core.d.ts +194 -0
- package/dist/elements/diagram/core.js +36 -0
- package/dist/elements/diagram/icon.svg +3 -0
- package/dist/elements/diagram/languages/en.d.ts +4 -0
- package/dist/elements/diagram/languages/en.js +2 -0
- package/dist/elements/diagram/languages/ru.d.ts +4 -0
- package/dist/elements/diagram/languages/ru.js +2 -0
- package/dist/elements/emphasis/Emphasis.vue +25 -0
- package/dist/elements/emphasis/_global.d.ts +18 -0
- package/dist/elements/emphasis/app.d.ts +9 -0
- package/dist/elements/emphasis/app.js +6 -0
- package/dist/elements/emphasis/core.d.ts +90 -0
- package/dist/elements/emphasis/core.js +32 -0
- package/dist/elements/flex/Flex.vue +32 -0
- package/dist/elements/flex/_global.d.ts +23 -0
- package/dist/elements/flex/app.d.ts +9 -0
- package/dist/elements/flex/app.js +11 -0
- package/dist/elements/flex/core.d.ts +67 -0
- package/dist/elements/flex/core.js +28 -0
- package/dist/elements/flex/icon.svg +3 -0
- package/dist/elements/flex/languages/en.d.ts +4 -0
- package/dist/elements/flex/languages/en.js +2 -0
- package/dist/elements/flex/languages/ru.d.ts +4 -0
- package/dist/elements/flex/languages/ru.js +2 -0
- package/dist/elements/gallery/Gallery.vue +56 -0
- package/dist/elements/gallery/_global.d.ts +18 -0
- package/dist/elements/gallery/app.d.ts +23 -0
- package/dist/elements/gallery/app.js +11 -0
- package/dist/elements/gallery/core.d.ts +138 -0
- package/dist/elements/gallery/core.js +21 -0
- package/dist/elements/gallery/icon.svg +3 -0
- package/dist/elements/gallery/languages/en.d.ts +4 -0
- package/dist/elements/gallery/languages/en.js +2 -0
- package/dist/elements/gallery/languages/ru.d.ts +4 -0
- package/dist/elements/gallery/languages/ru.js +2 -0
- package/dist/elements/heading/Heading.vue +44 -0
- package/dist/elements/heading/_global.d.ts +45 -0
- package/dist/elements/heading/app.d.ts +9 -0
- package/dist/elements/heading/app.js +11 -0
- package/dist/elements/heading/core.d.ts +108 -0
- package/dist/elements/heading/core.js +52 -0
- package/dist/elements/heading/icon.svg +3 -0
- package/dist/elements/heading/languages/en.d.ts +4 -0
- package/dist/elements/heading/languages/en.js +2 -0
- package/dist/elements/heading/languages/ru.d.ts +4 -0
- package/dist/elements/heading/languages/ru.js +2 -0
- package/dist/elements/horizontalLine/HorizontalLine.vue +6 -0
- package/dist/elements/horizontalLine/_global.d.ts +17 -0
- package/dist/elements/horizontalLine/app.d.ts +9 -0
- package/dist/elements/horizontalLine/app.js +6 -0
- package/dist/elements/horizontalLine/core.d.ts +54 -0
- package/dist/elements/horizontalLine/core.js +19 -0
- package/dist/elements/image/Image.vue +15 -0
- package/dist/elements/image/ImageElement.vue +80 -0
- package/dist/elements/image/_global.d.ts +18 -0
- package/dist/elements/image/app.d.ts +16 -0
- package/dist/elements/image/app.js +11 -0
- package/dist/elements/image/core.d.ts +136 -0
- package/dist/elements/image/core.js +44 -0
- package/dist/elements/image/icon.svg +3 -0
- package/dist/elements/image/languages/en.d.ts +4 -0
- package/dist/elements/image/languages/en.js +2 -0
- package/dist/elements/image/languages/ru.d.ts +4 -0
- package/dist/elements/image/languages/ru.js +2 -0
- package/dist/elements/image/storage.d.ts +6 -0
- package/dist/elements/image/storage.js +23 -0
- package/dist/elements/lineBreak/LineBreak.vue +3 -0
- package/dist/elements/lineBreak/_global.d.ts +18 -0
- package/dist/elements/lineBreak/app.d.ts +9 -0
- package/dist/elements/lineBreak/app.js +6 -0
- package/dist/elements/lineBreak/core.d.ts +54 -0
- package/dist/elements/lineBreak/core.js +19 -0
- package/dist/elements/link/BlockLink.vue +111 -0
- package/dist/elements/link/Link.vue +93 -0
- package/dist/elements/link/core.d.ts +13 -0
- package/dist/elements/link/core.js +12 -0
- package/dist/elements/link/dependency/_global.d.ts +47 -0
- package/dist/elements/link/dependency/app.d.ts +16 -0
- package/dist/elements/link/dependency/app.js +14 -0
- package/dist/elements/link/dependency/core.d.ts +125 -0
- package/dist/elements/link/dependency/core.js +51 -0
- package/dist/elements/link/dependency/languages/en.d.ts +4 -0
- package/dist/elements/link/dependency/languages/en.js +2 -0
- package/dist/elements/link/dependency/languages/ru.d.ts +4 -0
- package/dist/elements/link/dependency/languages/ru.js +2 -0
- package/dist/elements/link/icon.svg +3 -0
- package/dist/elements/link/reference/_global.d.ts +49 -0
- package/dist/elements/link/reference/app.d.ts +16 -0
- package/dist/elements/link/reference/app.js +14 -0
- package/dist/elements/link/reference/core.d.ts +120 -0
- package/dist/elements/link/reference/core.js +35 -0
- package/dist/elements/link/reference/languages/en.d.ts +4 -0
- package/dist/elements/link/reference/languages/en.js +2 -0
- package/dist/elements/link/reference/languages/ru.d.ts +4 -0
- package/dist/elements/link/reference/languages/ru.js +2 -0
- package/dist/elements/link/storage.d.ts +34 -0
- package/dist/elements/link/storage.js +20 -0
- package/dist/elements/list/List.vue +63 -0
- package/dist/elements/list/_global.d.ts +50 -0
- package/dist/elements/list/app.d.ts +16 -0
- package/dist/elements/list/app.js +11 -0
- package/dist/elements/list/core.d.ts +169 -0
- package/dist/elements/list/core.js +49 -0
- package/dist/elements/list/icon.svg +3 -0
- package/dist/elements/list/languages/en.d.ts +4 -0
- package/dist/elements/list/languages/en.js +2 -0
- package/dist/elements/list/languages/ru.d.ts +4 -0
- package/dist/elements/list/languages/ru.js +2 -0
- package/dist/elements/math/_global.d.ts +72 -0
- package/dist/elements/math/_global.ts +3 -0
- package/dist/elements/math/app.d.ts +16 -0
- package/dist/elements/math/app.js +20 -0
- package/dist/elements/math/block.d.ts +75 -0
- package/dist/elements/math/block.js +115 -0
- package/dist/elements/math/components/BlockMath.vue +30 -0
- package/dist/elements/math/components/InlinerMath.vue +65 -0
- package/dist/elements/math/components/Katex.vue +89 -0
- package/dist/elements/math/components/MathGroup.vue +39 -0
- package/dist/elements/math/core.d.ts +66 -0
- package/dist/elements/math/core.js +11 -0
- package/dist/elements/math/icon.svg +3 -0
- package/dist/elements/math/inliner.d.ts +64 -0
- package/dist/elements/math/inliner.js +85 -0
- package/dist/elements/math/katex.d.ts +8 -0
- package/dist/elements/math/katex.js +18 -0
- package/dist/elements/math/languages/en.d.ts +4 -0
- package/dist/elements/math/languages/en.js +2 -0
- package/dist/elements/math/languages/ru.d.ts +4 -0
- package/dist/elements/math/languages/ru.js +2 -0
- package/dist/elements/math/macros.d.ts +13 -0
- package/dist/elements/math/macros.js +12 -0
- package/dist/elements/paragraph/Paragraph.vue +27 -0
- package/dist/elements/paragraph/_global.d.ts +27 -0
- package/dist/elements/paragraph/app.d.ts +9 -0
- package/dist/elements/paragraph/app.js +11 -0
- package/dist/elements/paragraph/core.d.ts +67 -0
- package/dist/elements/paragraph/core.js +29 -0
- package/dist/elements/paragraph/icon.svg +4 -0
- package/dist/elements/paragraph/languages/en.d.ts +4 -0
- package/dist/elements/paragraph/languages/en.js +2 -0
- package/dist/elements/paragraph/languages/ru.d.ts +4 -0
- package/dist/elements/paragraph/languages/ru.js +2 -0
- package/dist/elements/problem/_global.d.ts +112 -0
- package/dist/elements/problem/app.d.ts +30 -0
- package/dist/elements/problem/app.js +27 -0
- package/dist/elements/problem/assets/actions/answer.svg +3 -0
- package/dist/elements/problem/assets/actions/check.svg +3 -0
- package/dist/elements/problem/assets/actions/generate.svg +3 -0
- package/dist/elements/problem/assets/actions/hint.svg +3 -0
- package/dist/elements/problem/assets/actions/note.svg +3 -0
- package/dist/elements/problem/assets/actions/solution.svg +3 -0
- package/dist/elements/problem/assets/attributes/applied.svg +3 -0
- package/dist/elements/problem/assets/attributes/inter.svg +3 -0
- package/dist/elements/problem/assets/attributes/method.svg +3 -0
- package/dist/elements/problem/assets/attributes/pretty.svg +1 -0
- package/dist/elements/problem/assets/icon.svg +3 -0
- package/dist/elements/problem/components/Problem.vue +22 -0
- package/dist/elements/problem/components/ProblemButton.vue +21 -0
- package/dist/elements/problem/components/ProblemContainer.vue +9 -0
- package/dist/elements/problem/components/ProblemContent.vue +371 -0
- package/dist/elements/problem/components/ProblemExpander.vue +7 -0
- package/dist/elements/problem/components/ProblemExpanderSection.vue +58 -0
- package/dist/elements/problem/components/ProblemHeader.vue +106 -0
- package/dist/elements/problem/components/Problems.vue +87 -0
- package/dist/elements/problem/components/SubProblem.vue +14 -0
- package/dist/elements/problem/components/expanders/Check.vue +151 -0
- package/dist/elements/problem/components/expanders/Checks.vue +83 -0
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -0
- package/dist/elements/problem/components/expanders/Hint.vue +26 -0
- package/dist/elements/problem/composables/phrase.d.ts +2 -0
- package/dist/elements/problem/composables/phrase.js +7 -0
- package/dist/elements/problem/composables/problemScript.d.ts +3 -0
- package/dist/elements/problem/composables/problemScript.js +11 -0
- package/dist/elements/problem/core.d.ts +248 -0
- package/dist/elements/problem/core.js +17 -0
- package/dist/elements/problem/languages/en.d.ts +3 -0
- package/dist/elements/problem/languages/en.js +24 -0
- package/dist/elements/problem/languages/ru.d.ts +3 -0
- package/dist/elements/problem/languages/ru.js +24 -0
- package/dist/elements/problem/phrases.d.ts +16 -0
- package/dist/elements/problem/phrases.js +1 -0
- package/dist/elements/problem/problem.d.ts +106 -0
- package/dist/elements/problem/problem.js +37 -0
- package/dist/elements/problem/problemContent.d.ts +439 -0
- package/dist/elements/problem/problemContent.js +236 -0
- package/dist/elements/problem/problemScript.d.ts +26 -0
- package/dist/elements/problem/problemScript.js +79 -0
- package/dist/elements/problem/problems.d.ts +212 -0
- package/dist/elements/problem/problems.js +74 -0
- package/dist/elements/problem/rng.d.ts +18 -0
- package/dist/elements/problem/rng.js +76 -0
- package/dist/elements/problem/shared.d.ts +28 -0
- package/dist/elements/problem/shared.js +42 -0
- package/dist/elements/problem/step.d.ts +5 -0
- package/dist/elements/problem/step.js +13 -0
- package/dist/elements/problem/storage.d.ts +5 -0
- package/dist/elements/problem/storage.js +8 -0
- package/dist/elements/table/Table.vue +104 -0
- package/dist/elements/table/_global.d.ts +36 -0
- package/dist/elements/table/app.d.ts +30 -0
- package/dist/elements/table/app.js +11 -0
- package/dist/elements/table/core.d.ts +324 -0
- package/dist/elements/table/core.js +65 -0
- package/dist/elements/table/icon.svg +3 -0
- package/dist/elements/table/languages/en.d.ts +4 -0
- package/dist/elements/table/languages/en.js +2 -0
- package/dist/elements/table/languages/ru.d.ts +4 -0
- package/dist/elements/table/languages/ru.js +2 -0
- package/dist/elements/video/Video.vue +109 -0
- package/dist/elements/video/_global.d.ts +18 -0
- package/dist/elements/video/app.d.ts +16 -0
- package/dist/elements/video/app.js +11 -0
- package/dist/elements/video/core.d.ts +128 -0
- package/dist/elements/video/core.js +43 -0
- package/dist/elements/video/icon.svg +3 -0
- package/dist/elements/video/languages/en.d.ts +4 -0
- package/dist/elements/video/languages/en.js +2 -0
- package/dist/elements/video/languages/ru.d.ts +4 -0
- package/dist/elements/video/languages/ru.js +2 -0
- package/dist/elements/video/storage.d.ts +2 -0
- package/dist/elements/video/storage.js +5 -0
- package/dist/include.d.ts +6 -0
- package/dist/include.js +42 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +15 -0
- package/dist/rawElement.d.ts +6 -0
- package/dist/rawElement.js +3 -0
- package/dist/resolve.d.ts +20 -0
- package/dist/resolve.js +99 -0
- package/dist/resolveStep.d.ts +9 -0
- package/dist/resolveStep.js +3 -0
- package/dist/shared/filePath.d.ts +5 -0
- package/dist/shared/filePath.js +11 -0
- package/dist/shared/invert.d.ts +1 -0
- package/dist/shared/invert.js +1 -0
- package/dist/shared/paragraphWrap.d.ts +3 -0
- package/dist/shared/paragraphWrap.js +15 -0
- package/dist/shared/photoswipe.d.ts +10 -0
- package/dist/shared/photoswipe.js +10 -0
- package/dist/slugify/index.d.ts +1 -0
- package/dist/slugify/index.js +12 -0
- package/dist/slugify/languages/en.d.ts +2 -0
- package/dist/slugify/languages/en.js +3 -0
- package/dist/slugify/languages/ru.d.ts +2 -0
- package/dist/slugify/languages/ru.js +38 -0
- package/dist/snippet.d.ts +66 -0
- package/dist/snippet.js +57 -0
- package/dist/tag.d.ts +22 -0
- package/dist/tag.js +20 -0
- package/dist/title.d.ts +8 -0
- package/dist/title.js +6 -0
- package/dist/toc.d.ts +34 -0
- package/dist/toc.js +52 -0
- package/dist/utils/case.d.ts +4 -0
- package/dist/utils/case.js +8 -0
- package/dist/utils/docs.d.ts +1 -0
- package/dist/utils/docs.js +22 -0
- package/package.json +48 -0
- package/types.d.ts +4 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inliner math is used to display mathematical expressions within a line of text.
|
|
3
|
+
* It supports line breaks and has a faint of brand color to distinguish it from regular text.
|
|
4
|
+
*
|
|
5
|
+
* **Caution:** Never write long mathematical expressions in inliner math because it looks horrible.
|
|
6
|
+
* Use it for variables, numbers, or short two to three term expressions only.
|
|
7
|
+
*
|
|
8
|
+
* Math is written using [LaTeX syntax](https://www.latex-project.org/) and rendered using [KaTeX](https://katex.org/docs/supported.html).
|
|
9
|
+
*
|
|
10
|
+
* You can also use nice colors in your math expressions:
|
|
11
|
+
* * `\brand{...}`
|
|
12
|
+
* * `\blue{...}`
|
|
13
|
+
* * `\green{...}`
|
|
14
|
+
* * `\yellow{...}`
|
|
15
|
+
* * `\red{...}`
|
|
16
|
+
* * `\default{...}` (to reset to default color)
|
|
17
|
+
*
|
|
18
|
+
* @title Inliner Math
|
|
19
|
+
* @layout inliner
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <>
|
|
23
|
+
* We need variables <M>x</M> and <M>y</M>.
|
|
24
|
+
* They are wrapped in square roots <M>{math`\sqrt{x}`}</M> and <M>{math`\sqrt{y}`}</M>.
|
|
25
|
+
* </>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const M = '_tag_';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Block math is used to display mathematical expressions as separate blocks.
|
|
32
|
+
* Use it for larger equations that need to be centered and stand out from the main text.
|
|
33
|
+
*
|
|
34
|
+
* Math is written using [LaTeX syntax](https://www.latex-project.org/) and rendered using [KaTeX](https://katex.org/docs/supported.html).
|
|
35
|
+
*
|
|
36
|
+
* You can also use nice colors in your math expressions:
|
|
37
|
+
* * `\brand{...}`
|
|
38
|
+
* * `\blue{...}`
|
|
39
|
+
* * `\green{...}`
|
|
40
|
+
* * `\yellow{...}`
|
|
41
|
+
* * `\red{...}`
|
|
42
|
+
* * `\default{...}` (to reset to default color)
|
|
43
|
+
*
|
|
44
|
+
* Use `freeze` prop to prevent line breaks in the rendered math (scrollbars will appear if the content overflows).
|
|
45
|
+
*
|
|
46
|
+
* @title Block Math
|
|
47
|
+
* @layout block
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <BlockMath>{math`
|
|
51
|
+
* A^2 + \green{B^2} = \brand{C^2}
|
|
52
|
+
* `}</BlockMath>
|
|
53
|
+
*
|
|
54
|
+
* <BlockMath freeze>{math`
|
|
55
|
+
* \lim\limits_{x \to \infty} \frac{1}{x} = 0
|
|
56
|
+
* `}</BlockMath>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export const BlockMath = '_tag_';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Math template tag function for writing LaTeX math expressions.
|
|
63
|
+
* It allows not to escape backslashes in LaTeX commands.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* const bad = `\\frac{a}{b}`;
|
|
68
|
+
* // But
|
|
69
|
+
* const good = math`\frac{a}{b}`;
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export const math: typeof String.raw;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: (import("../../app/appElement.js").AppElement<{
|
|
2
|
+
name: "blockMath";
|
|
3
|
+
type: "block";
|
|
4
|
+
linkable: true;
|
|
5
|
+
Data: import("./block.js").BlockMathData;
|
|
6
|
+
Storage: import("./block.js").MathGroup;
|
|
7
|
+
Children: undefined;
|
|
8
|
+
}> | import("../../app/appElement.js").AppElement<{
|
|
9
|
+
name: "inlinerMath";
|
|
10
|
+
type: "inliner";
|
|
11
|
+
linkable: true;
|
|
12
|
+
Data: string;
|
|
13
|
+
Storage: import("./inliner.js").InlinerMathStorage;
|
|
14
|
+
Children: undefined;
|
|
15
|
+
}>)[];
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineEruditProseAppElement } from "../../app/appElement.js";
|
|
2
|
+
import { blockMathSchema } from "./block.js";
|
|
3
|
+
import { inlinerMathSchema } from "./inliner.js";
|
|
4
|
+
export default [defineEruditProseAppElement({
|
|
5
|
+
schema: blockMathSchema,
|
|
6
|
+
component: () => import("./components/BlockMath.vue"),
|
|
7
|
+
languages: {
|
|
8
|
+
en: () => import("./languages/en.js"),
|
|
9
|
+
ru: () => import("./languages/ru.js")
|
|
10
|
+
},
|
|
11
|
+
icon: () => import("./icon.svg?raw")
|
|
12
|
+
}), defineEruditProseAppElement({
|
|
13
|
+
schema: inlinerMathSchema,
|
|
14
|
+
component: () => import("./components/InlinerMath.vue"),
|
|
15
|
+
languages: {
|
|
16
|
+
en: () => import("./languages/en.js"),
|
|
17
|
+
ru: () => import("./languages/ru.js")
|
|
18
|
+
},
|
|
19
|
+
icon: () => import("./icon.svg?raw")
|
|
20
|
+
})];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type TagChildren } from '@jsprose/core';
|
|
2
|
+
export declare const mathGroupTypes: readonly ["zero", "normal", "big"];
|
|
3
|
+
export type MathGroupGapType = (typeof mathGroupTypes)[number] | 'custom';
|
|
4
|
+
export interface MathGroupGapTemplate {
|
|
5
|
+
type: MathGroupGapType;
|
|
6
|
+
}
|
|
7
|
+
export interface MathGroupGapNone extends MathGroupGapTemplate {
|
|
8
|
+
type: 'zero';
|
|
9
|
+
}
|
|
10
|
+
export interface MathGroupGapNormal extends MathGroupGapTemplate {
|
|
11
|
+
type: 'normal';
|
|
12
|
+
}
|
|
13
|
+
export interface MathGroupGapBig extends MathGroupGapTemplate {
|
|
14
|
+
type: 'big';
|
|
15
|
+
}
|
|
16
|
+
export interface MathGroupGapCustom extends MathGroupGapTemplate {
|
|
17
|
+
type: 'custom';
|
|
18
|
+
size: string;
|
|
19
|
+
}
|
|
20
|
+
export type MathGroupGap = MathGroupGapNone | MathGroupGapNormal | MathGroupGapBig | MathGroupGapCustom;
|
|
21
|
+
export type MathGroupPart = string | MathGroup;
|
|
22
|
+
export interface MathGroup {
|
|
23
|
+
gap: MathGroupGap;
|
|
24
|
+
parts: MathGroupPart[];
|
|
25
|
+
}
|
|
26
|
+
export declare function resolveMathGroups(katex: string, isTopLevel?: boolean): Promise<MathGroup | string>;
|
|
27
|
+
export interface BlockMathData {
|
|
28
|
+
katex: string;
|
|
29
|
+
freeze?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const blockMathSchema: {
|
|
32
|
+
name: "blockMath";
|
|
33
|
+
type: "block";
|
|
34
|
+
linkable: true;
|
|
35
|
+
Data: BlockMathData;
|
|
36
|
+
Storage: MathGroup;
|
|
37
|
+
Children: undefined;
|
|
38
|
+
};
|
|
39
|
+
export declare const BlockMath: import("@jsprose/core").Tag<"BlockMath", {
|
|
40
|
+
name: "blockMath";
|
|
41
|
+
type: "block";
|
|
42
|
+
linkable: true;
|
|
43
|
+
Data: BlockMathData;
|
|
44
|
+
Storage: MathGroup;
|
|
45
|
+
Children: undefined;
|
|
46
|
+
}, {
|
|
47
|
+
freeze?: boolean;
|
|
48
|
+
} & TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
49
|
+
export declare const blockMathRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
50
|
+
name: "blockMath";
|
|
51
|
+
type: "block";
|
|
52
|
+
linkable: true;
|
|
53
|
+
Data: BlockMathData;
|
|
54
|
+
Storage: MathGroup;
|
|
55
|
+
Children: undefined;
|
|
56
|
+
}, {
|
|
57
|
+
BlockMath: import("@jsprose/core").Tag<"BlockMath", {
|
|
58
|
+
name: "blockMath";
|
|
59
|
+
type: "block";
|
|
60
|
+
linkable: true;
|
|
61
|
+
Data: BlockMathData;
|
|
62
|
+
Storage: MathGroup;
|
|
63
|
+
Children: undefined;
|
|
64
|
+
}, {
|
|
65
|
+
freeze?: boolean;
|
|
66
|
+
} & TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
67
|
+
}, (element: import("@jsprose/core").ProseElement<{
|
|
68
|
+
name: "blockMath";
|
|
69
|
+
type: "block";
|
|
70
|
+
linkable: true;
|
|
71
|
+
Data: BlockMathData;
|
|
72
|
+
Storage: MathGroup;
|
|
73
|
+
Children: undefined;
|
|
74
|
+
}>) => Promise<MathGroup>>;
|
|
75
|
+
export declare function createBlockMathStorage(katex: string): Promise<MathGroup>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { defineRegistryItem, defineSchema, ensureTagChild, ProseError, textSchema } from "@jsprose/core";
|
|
2
|
+
import { latexToHtml, normalizeKatex } from "./katex.js";
|
|
3
|
+
import { defineEruditTag } from "../../tag.js";
|
|
4
|
+
export const mathGroupTypes = [
|
|
5
|
+
"zero",
|
|
6
|
+
"normal",
|
|
7
|
+
"big"
|
|
8
|
+
];
|
|
9
|
+
function gapFromString(strGap) {
|
|
10
|
+
if (mathGroupTypes.includes(strGap)) {
|
|
11
|
+
return { type: strGap };
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
type: "custom",
|
|
15
|
+
size: strGap
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function gapsEqual(gap1, gap2) {
|
|
19
|
+
if (gap1.type !== gap2.type) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (gap1.type === "custom" && gap2.type === "custom") {
|
|
23
|
+
return gap1.size === gap2.size;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
export async function resolveMathGroups(katex, isTopLevel = true) {
|
|
28
|
+
// If whole string does not contain any groups, return default group with rendered math
|
|
29
|
+
if (!katex.includes(">>")) {
|
|
30
|
+
const rendered = await latexToHtml(katex, "block");
|
|
31
|
+
if (isTopLevel) {
|
|
32
|
+
// Only top-level should return a group
|
|
33
|
+
return {
|
|
34
|
+
gap: { type: "normal" },
|
|
35
|
+
parts: [rendered]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Recursive left side should return a plain string
|
|
39
|
+
return rendered;
|
|
40
|
+
}
|
|
41
|
+
// Find the rightmost delimiter and its gap specification
|
|
42
|
+
const delimiterRegex = />>(?:\{([^}]+)\})?/g;
|
|
43
|
+
let match;
|
|
44
|
+
let lastDelimiterMatch;
|
|
45
|
+
while ((match = delimiterRegex.exec(katex)) !== null) {
|
|
46
|
+
lastDelimiterMatch = match;
|
|
47
|
+
}
|
|
48
|
+
// Extract gap
|
|
49
|
+
const gap = gapFromString(lastDelimiterMatch[1] || "normal");
|
|
50
|
+
// Calculate positions
|
|
51
|
+
const lastDelimiterPos = lastDelimiterMatch.index;
|
|
52
|
+
const lastDelimiterLen = lastDelimiterMatch[0].length;
|
|
53
|
+
// Split the katex string
|
|
54
|
+
const leftPart = katex.slice(0, lastDelimiterPos);
|
|
55
|
+
const rightPart = katex.slice(lastDelimiterPos + lastDelimiterLen);
|
|
56
|
+
// Pushing rendered right part
|
|
57
|
+
const parts = [await latexToHtml(rightPart, "block")];
|
|
58
|
+
// Resolving left part
|
|
59
|
+
const leftGroup = await resolveMathGroups(leftPart, false);
|
|
60
|
+
if (typeof leftGroup === "string") {
|
|
61
|
+
parts.unshift(leftGroup);
|
|
62
|
+
} else {
|
|
63
|
+
// Left part is a group, meaning it contains gaps
|
|
64
|
+
if (gapsEqual(leftGroup.gap, gap)) {
|
|
65
|
+
// If gaps are equal, we can merge the two groups into (current) one
|
|
66
|
+
parts.unshift(...leftGroup.parts);
|
|
67
|
+
} else {
|
|
68
|
+
// Gaps are different, we need to keep the left group as is
|
|
69
|
+
parts.unshift(leftGroup);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
gap,
|
|
74
|
+
parts
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export const blockMathSchema = defineSchema({
|
|
78
|
+
name: "blockMath",
|
|
79
|
+
type: "block",
|
|
80
|
+
linkable: true
|
|
81
|
+
})();
|
|
82
|
+
export const BlockMath = defineEruditTag({
|
|
83
|
+
tagName: "BlockMath",
|
|
84
|
+
schema: blockMathSchema
|
|
85
|
+
})(({ element, tagName, props, children }) => {
|
|
86
|
+
ensureTagChild(tagName, children, textSchema);
|
|
87
|
+
const katex = normalizeKatex(children[0].data);
|
|
88
|
+
if (!katex) {
|
|
89
|
+
throw new ProseError(`<${tagName}> tag must contain non-empty KaTeX math expression.`);
|
|
90
|
+
}
|
|
91
|
+
element.data = {
|
|
92
|
+
katex,
|
|
93
|
+
freeze: props.freeze === true
|
|
94
|
+
};
|
|
95
|
+
element.storageKey = `$$ ${katex} $$`;
|
|
96
|
+
});
|
|
97
|
+
export const blockMathRegistryItem = defineRegistryItem({
|
|
98
|
+
schema: blockMathSchema,
|
|
99
|
+
tags: [BlockMath],
|
|
100
|
+
async createStorage(element) {
|
|
101
|
+
return createBlockMathStorage(element.data.katex);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export async function createBlockMathStorage(katex) {
|
|
105
|
+
let result = {
|
|
106
|
+
gap: { type: "normal" },
|
|
107
|
+
parts: ["<span style=\"color: red\">KaTeX Error!</span>"]
|
|
108
|
+
};
|
|
109
|
+
try {
|
|
110
|
+
result = await resolveMathGroups(katex);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error("Error while rendering math:", error);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type blockMathSchema,
|
|
6
|
+
type MathGroup as _MathGroup,
|
|
7
|
+
createBlockMathStorage,
|
|
8
|
+
} from '../block.js';
|
|
9
|
+
import { useElementStorage } from '../../../app/composables/storage.js';
|
|
10
|
+
import MathGroup from './MathGroup.vue';
|
|
11
|
+
import Block from '../../../app/shared/block/Block.vue';
|
|
12
|
+
|
|
13
|
+
const { element } = defineProps<{
|
|
14
|
+
element: ProseElement<typeof blockMathSchema>;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const blockMathStorage =
|
|
18
|
+
(await useElementStorage<typeof blockMathSchema>(element)) ??
|
|
19
|
+
(await createBlockMathStorage(element.data.katex));
|
|
20
|
+
|
|
21
|
+
const mathGroup: _MathGroup = blockMathStorage;
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<Block :element>
|
|
26
|
+
<div :style="{ '--mathRowGap': '.6em' }">
|
|
27
|
+
<MathGroup :mathGroup :freeze="Boolean(element.data.freeze)" />
|
|
28
|
+
</div>
|
|
29
|
+
</Block>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import 'katex/dist/katex.min.css';
|
|
3
|
+
import type { ProseElement } from '@jsprose/core';
|
|
4
|
+
|
|
5
|
+
import Inliner from '../../../app/shared/inliner/Inliner.vue';
|
|
6
|
+
import {
|
|
7
|
+
createInlinerMathStorage,
|
|
8
|
+
type inlinerMathSchema,
|
|
9
|
+
} from '../inliner.js';
|
|
10
|
+
import { useElementStorage } from '../../../app/composables/storage.js';
|
|
11
|
+
import Katex from './Katex.vue';
|
|
12
|
+
|
|
13
|
+
const { element } = defineProps<{
|
|
14
|
+
element: ProseElement<typeof inlinerMathSchema>;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const inlinerMathStorage =
|
|
18
|
+
(await useElementStorage<typeof inlinerMathSchema>(element)) ??
|
|
19
|
+
(await createInlinerMathStorage(element.data));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<Inliner :element>
|
|
24
|
+
<template v-if="inlinerMathStorage.type === 'text'">
|
|
25
|
+
<span :class="[$style.inlinerMath, $style.textMath]">
|
|
26
|
+
<template v-for="token of inlinerMathStorage.tokens">
|
|
27
|
+
<span :class="{ [$style.word]: token.type === 'word' }">
|
|
28
|
+
{{ token.value }}
|
|
29
|
+
</span>
|
|
30
|
+
</template>
|
|
31
|
+
</span>
|
|
32
|
+
</template>
|
|
33
|
+
<Katex
|
|
34
|
+
v-else
|
|
35
|
+
:class="$style.inlinerMath"
|
|
36
|
+
:math="inlinerMathStorage.mathHtml"
|
|
37
|
+
mode="inline"
|
|
38
|
+
:freeze="false"
|
|
39
|
+
/>
|
|
40
|
+
</Inliner>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style module>
|
|
44
|
+
.inlinerMath {
|
|
45
|
+
--katex-color_default: light-dark(
|
|
46
|
+
color-mix(in hsl, var(--color-text-muted), var(--color-brand) 35%),
|
|
47
|
+
color-mix(in hsl, var(--color-text), var(--color-brand) 30%)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.textMath {
|
|
52
|
+
font:
|
|
53
|
+
normal 1.15em KaTeX_Main,
|
|
54
|
+
Times New Roman,
|
|
55
|
+
serif;
|
|
56
|
+
line-height: 1.2;
|
|
57
|
+
text-indent: 0;
|
|
58
|
+
color: var(--katex-color_default);
|
|
59
|
+
|
|
60
|
+
.word {
|
|
61
|
+
font-family: KaTeX_Math;
|
|
62
|
+
font-style: italic;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { h } from 'vue';
|
|
3
|
+
import 'katex/dist/katex.min.css';
|
|
4
|
+
|
|
5
|
+
const { mode, math, freeze } = defineProps<{
|
|
6
|
+
mode: 'inline' | 'block';
|
|
7
|
+
math: string;
|
|
8
|
+
freeze: boolean;
|
|
9
|
+
}>();
|
|
10
|
+
|
|
11
|
+
const MathComponent = h(mode === 'block' ? 'div' : 'span', {
|
|
12
|
+
innerHTML: math,
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<component
|
|
18
|
+
:is="MathComponent"
|
|
19
|
+
v-once
|
|
20
|
+
:class="[
|
|
21
|
+
$style.math,
|
|
22
|
+
{
|
|
23
|
+
[`nice-scrollbars overflow-auto ${$style.blockMath}`]:
|
|
24
|
+
mode === 'block',
|
|
25
|
+
[$style.freeze]: freeze,
|
|
26
|
+
},
|
|
27
|
+
]"
|
|
28
|
+
/>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<style module>
|
|
32
|
+
.math {
|
|
33
|
+
--katex-color_brand: var(--color-brand);
|
|
34
|
+
--katex-color_blue: light-dark(#0f82ff, #4aa0df);
|
|
35
|
+
--katex-color_green: light-dark(#519f19, #83c167);
|
|
36
|
+
--katex-color_yellow: light-dark(#c99029, #c1a267);
|
|
37
|
+
--katex-color_red: light-dark(#d73737, #fc6255);
|
|
38
|
+
--katex-color_default: var(--color-text);
|
|
39
|
+
|
|
40
|
+
color: var(--katex-color_default);
|
|
41
|
+
|
|
42
|
+
/* Map KaTeX color codes to CSS variables */
|
|
43
|
+
[style*='color:#100000'] {
|
|
44
|
+
color: var(--katex-color_brand) !important;
|
|
45
|
+
}
|
|
46
|
+
[style*='color:#200000'] {
|
|
47
|
+
color: var(--katex-color_blue) !important;
|
|
48
|
+
}
|
|
49
|
+
[style*='color:#300000'] {
|
|
50
|
+
color: var(--katex-color_green) !important;
|
|
51
|
+
}
|
|
52
|
+
[style*='color:#400000'] {
|
|
53
|
+
color: var(--katex-color_yellow) !important;
|
|
54
|
+
}
|
|
55
|
+
[style*='color:#500000'] {
|
|
56
|
+
color: var(--katex-color_red) !important;
|
|
57
|
+
}
|
|
58
|
+
[style*='color:#600000'] {
|
|
59
|
+
color: var(--katex-color_default) !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.blockMath {
|
|
64
|
+
overflow-x: auto;
|
|
65
|
+
overflow-y: hidden;
|
|
66
|
+
|
|
67
|
+
:global(.katex-display) {
|
|
68
|
+
margin: 0;
|
|
69
|
+
margin-top: calc(-1 * var(--mathRowGap));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(.base) {
|
|
73
|
+
margin-top: var(--mathRowGap);
|
|
74
|
+
padding-bottom: 1px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:not(.freeze) {
|
|
78
|
+
:global(.katex-display > .katex) {
|
|
79
|
+
max-width: 100% !important;
|
|
80
|
+
overflow: hidden !important;
|
|
81
|
+
white-space: normal !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.freeze {
|
|
86
|
+
min-width: 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { MathGroup } from '../block.js';
|
|
3
|
+
import Katex from './Katex.vue';
|
|
4
|
+
|
|
5
|
+
const { mathGroup } = defineProps<{
|
|
6
|
+
mathGroup: MathGroup;
|
|
7
|
+
freeze: boolean;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const columnGap = (() => {
|
|
11
|
+
switch (mathGroup.gap.type) {
|
|
12
|
+
case 'zero':
|
|
13
|
+
return '0px';
|
|
14
|
+
case 'normal':
|
|
15
|
+
return 'var(--proseAsideWidth)';
|
|
16
|
+
case 'big':
|
|
17
|
+
return 'calc(var(--proseAsideWidth) * 2)';
|
|
18
|
+
case 'custom':
|
|
19
|
+
return mathGroup.gap.size;
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div
|
|
26
|
+
:style="{ columnGap }"
|
|
27
|
+
class="flex flex-wrap items-center justify-center gap-y-(--mathRowGap)"
|
|
28
|
+
>
|
|
29
|
+
<template v-for="part of mathGroup.parts">
|
|
30
|
+
<Katex
|
|
31
|
+
v-if="typeof part === 'string'"
|
|
32
|
+
mode="block"
|
|
33
|
+
:math="part"
|
|
34
|
+
:freeze
|
|
35
|
+
/>
|
|
36
|
+
<MathGroup v-else :mathGroup="part" :freeze="freeze" />
|
|
37
|
+
</template>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare const _default: [{
|
|
2
|
+
registryItem: import("@jsprose/core").RegistryItem<{
|
|
3
|
+
name: "inlinerMath";
|
|
4
|
+
type: "inliner";
|
|
5
|
+
linkable: true;
|
|
6
|
+
Data: string;
|
|
7
|
+
Storage: import("./inliner.js").InlinerMathStorage;
|
|
8
|
+
Children: undefined;
|
|
9
|
+
}, {
|
|
10
|
+
M: import("@jsprose/core").Tag<"M", {
|
|
11
|
+
name: "inlinerMath";
|
|
12
|
+
type: "inliner";
|
|
13
|
+
linkable: true;
|
|
14
|
+
Data: string;
|
|
15
|
+
Storage: import("./inliner.js").InlinerMathStorage;
|
|
16
|
+
Children: undefined;
|
|
17
|
+
}, import("@jsprose/core").TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
18
|
+
}, (element: import("@jsprose/core").ProseElement<{
|
|
19
|
+
name: "inlinerMath";
|
|
20
|
+
type: "inliner";
|
|
21
|
+
linkable: true;
|
|
22
|
+
Data: string;
|
|
23
|
+
Storage: import("./inliner.js").InlinerMathStorage;
|
|
24
|
+
Children: undefined;
|
|
25
|
+
}>) => Promise<import("./inliner.js").InlinerMathStorage>>;
|
|
26
|
+
dependencies: {
|
|
27
|
+
katex: {
|
|
28
|
+
optimise: boolean;
|
|
29
|
+
transpile: boolean;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
33
|
+
registryItem: import("@jsprose/core").RegistryItem<{
|
|
34
|
+
name: "blockMath";
|
|
35
|
+
type: "block";
|
|
36
|
+
linkable: true;
|
|
37
|
+
Data: import("./block.js").BlockMathData;
|
|
38
|
+
Storage: import("./block.js").MathGroup;
|
|
39
|
+
Children: undefined;
|
|
40
|
+
}, {
|
|
41
|
+
BlockMath: import("@jsprose/core").Tag<"BlockMath", {
|
|
42
|
+
name: "blockMath";
|
|
43
|
+
type: "block";
|
|
44
|
+
linkable: true;
|
|
45
|
+
Data: import("./block.js").BlockMathData;
|
|
46
|
+
Storage: import("./block.js").MathGroup;
|
|
47
|
+
Children: undefined;
|
|
48
|
+
}, {
|
|
49
|
+
freeze?: boolean;
|
|
50
|
+
} & import("@jsprose/core").TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
51
|
+
}, (element: import("@jsprose/core").ProseElement<{
|
|
52
|
+
name: "blockMath";
|
|
53
|
+
type: "block";
|
|
54
|
+
linkable: true;
|
|
55
|
+
Data: import("./block.js").BlockMathData;
|
|
56
|
+
Storage: import("./block.js").MathGroup;
|
|
57
|
+
Children: undefined;
|
|
58
|
+
}>) => Promise<import("./block.js").MathGroup>>;
|
|
59
|
+
dependencies: {
|
|
60
|
+
katex: {
|
|
61
|
+
optimise: boolean;
|
|
62
|
+
transpile: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}];
|
|
66
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineEruditProseCoreElements } from "../../coreElement.js";
|
|
2
|
+
import { blockMathRegistryItem } from "./block.js";
|
|
3
|
+
import { inlinerMathRegistryItem } from "./inliner.js";
|
|
4
|
+
import { katexDependency } from "./katex.js";
|
|
5
|
+
export default defineEruditProseCoreElements({
|
|
6
|
+
registryItem: inlinerMathRegistryItem,
|
|
7
|
+
dependencies: katexDependency
|
|
8
|
+
}, {
|
|
9
|
+
registryItem: blockMathRegistryItem,
|
|
10
|
+
dependencies: katexDependency
|
|
11
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960">
|
|
2
|
+
<path d="M221-120q-45 0-73-24t-28-64q0-32 17-51.5t43-19.5q25 0 42.5 17t17.5 41q0 5-.5 9t-1.5 9q5-1 8.5-5.5T252-221l62-339h-74q-17 0-28.5-11.5T200-600q0-17 11.5-28.5T240-640h89l21-114q7-38 37.5-62t72.5-24q44 0 72 26t28 65q0 30-17 49.5T500-680q-25 0-42.5-17T440-739q0-5 .5-9t1.5-9q-6 2-9 6t-5 12l-17 99h149q17 0 28.5 11.5T600-600q0 15-9.5 26T567-561l53 60 53-60q-14-2-23.5-13t-9.5-26q0-17 11.5-28.5T680-640h120q17 0 28.5 11.5T840-600q0 17-11.5 28.5T800-560h-22L673-440l105 120h22q17 0 28.5 11.5T840-280q0 17-11.5 28.5T800-240H680q-17 0-28.5-11.5T640-280q0-15 9.5-26t23.5-13l-53-61-53 61q14 2 23.5 13t9.5 26q0 17-11.5 28.5T560-240H440q-17 0-28.5-11.5T400-280q0-17 11.5-28.5T440-320h22l105-120-105-120h-66l-64 344q-8 45-37 70.5T221-120Z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type TagChildren } from '@jsprose/core';
|
|
2
|
+
export type InlinerMathType = 'katex' | 'text';
|
|
3
|
+
interface InlinerMathBase {
|
|
4
|
+
type: InlinerMathType;
|
|
5
|
+
}
|
|
6
|
+
export interface InlinerMathKatex extends InlinerMathBase {
|
|
7
|
+
type: 'katex';
|
|
8
|
+
mathHtml: string;
|
|
9
|
+
}
|
|
10
|
+
export type InlinerMathToken = {
|
|
11
|
+
type: 'word' | 'other';
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
export interface InlinerMathText extends InlinerMathBase {
|
|
15
|
+
type: 'text';
|
|
16
|
+
tokens: InlinerMathToken[];
|
|
17
|
+
}
|
|
18
|
+
export type InlinerMathStorage = InlinerMathKatex | InlinerMathText;
|
|
19
|
+
/**
|
|
20
|
+
* Try to use simple text mode for inline math as it is significantly better for SEO, faster and smaller.
|
|
21
|
+
*/
|
|
22
|
+
export declare function tryTextInlinerMath(expression: string): InlinerMathText | undefined;
|
|
23
|
+
export declare const inlinerMathSchema: {
|
|
24
|
+
name: "inlinerMath";
|
|
25
|
+
type: "inliner";
|
|
26
|
+
linkable: true;
|
|
27
|
+
Data: string;
|
|
28
|
+
Storage: InlinerMathStorage;
|
|
29
|
+
Children: undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const M: import("@jsprose/core").Tag<"M", {
|
|
32
|
+
name: "inlinerMath";
|
|
33
|
+
type: "inliner";
|
|
34
|
+
linkable: true;
|
|
35
|
+
Data: string;
|
|
36
|
+
Storage: InlinerMathStorage;
|
|
37
|
+
Children: undefined;
|
|
38
|
+
}, TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
39
|
+
export declare const inlinerMathRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
40
|
+
name: "inlinerMath";
|
|
41
|
+
type: "inliner";
|
|
42
|
+
linkable: true;
|
|
43
|
+
Data: string;
|
|
44
|
+
Storage: InlinerMathStorage;
|
|
45
|
+
Children: undefined;
|
|
46
|
+
}, {
|
|
47
|
+
M: import("@jsprose/core").Tag<"M", {
|
|
48
|
+
name: "inlinerMath";
|
|
49
|
+
type: "inliner";
|
|
50
|
+
linkable: true;
|
|
51
|
+
Data: string;
|
|
52
|
+
Storage: InlinerMathStorage;
|
|
53
|
+
Children: undefined;
|
|
54
|
+
}, TagChildren & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet & import("../../snippet.js").ObjPropSearch & import("../../snippet.js").ObjPropQuick & import("../../snippet.js").ObjPropSeo>;
|
|
55
|
+
}, (element: import("@jsprose/core").ProseElement<{
|
|
56
|
+
name: "inlinerMath";
|
|
57
|
+
type: "inliner";
|
|
58
|
+
linkable: true;
|
|
59
|
+
Data: string;
|
|
60
|
+
Storage: InlinerMathStorage;
|
|
61
|
+
Children: undefined;
|
|
62
|
+
}>) => Promise<InlinerMathStorage>>;
|
|
63
|
+
export declare function createInlinerMathStorage(katex: string): Promise<InlinerMathStorage>;
|
|
64
|
+
export {};
|