The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(math): typst support(closes #1568) (#1569)

Co-authored-by: Aaron Pham <contact@aarnphm.xyz>
Co-authored-by: Aaron Pham <Aaronpham0103@gmail.com>

authored by

Han-Miru Kim
Aaron Pham
Aaron Pham
and committed by
GitHub
9188939b 92676d74

+280 -151
+5 -1
docs/plugins/Latex.md
··· 11 11 12 12 This plugin accepts the following configuration options: 13 13 14 - - `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for [KaTeX](https://katex.org/) or `"mathjax"` for [MathJax](https://www.mathjax.org/) [SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html). Defaults to KaTeX. 14 + - `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for [KaTeX](https://katex.org/), `"mathjax"` for [MathJax](https://www.mathjax.org/) [SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html), or `"typst"` for [Typst](https://typst.app/) (a new way to compose LaTeX equation). Defaults to KaTeX. 15 15 - `customMacros`: custom macros for all LaTeX blocks. It takes the form of a key-value pair where the key is a new command name and the value is the expansion of the macro. For example: `{"\\R": "\\mathbb{R}"}` 16 + 17 + > [!note] Typst support 18 + > 19 + > Currently, typst doesn't support inline-math 16 20 17 21 ## API 18 22
+236 -126
package-lock.json
··· 11 11 "dependencies": { 12 12 "@clack/prompts": "^0.7.0", 13 13 "@floating-ui/dom": "^1.6.12", 14 + "@myriaddreamin/rehype-typst": "^0.5.0-rc7", 14 15 "@napi-rs/simple-git": "0.1.19", 15 16 "@tweenjs/tween.js": "^25.0.0", 16 17 "async-mutex": "^0.5.0", ··· 714 715 "langium": "3.0.0" 715 716 } 716 717 }, 718 + "node_modules/@myriaddreamin/rehype-typst": { 719 + "version": "0.5.0-rc7", 720 + "resolved": "https://registry.npmjs.org/@myriaddreamin/rehype-typst/-/rehype-typst-0.5.0-rc7.tgz", 721 + "integrity": "sha512-oIUmJzV8c+PZoV4TZwSupN9e06EaC2i0DpjU6NPe6y0HE7MoPOd35s6i+RjdSNPDguqBdP2MO4VaqnGahQW/ig==", 722 + "license": "MIT", 723 + "dependencies": { 724 + "@myriaddreamin/typst-ts-node-compiler": "^0.5.0-rc7", 725 + "@types/hast": "^3.0.0", 726 + "@types/katex": "^0.16.0", 727 + "hast-util-from-html-isomorphic": "^2.0.0", 728 + "hast-util-to-text": "^4.0.0", 729 + "https-proxy-agent": "^7.0.2", 730 + "unist-util-visit-parents": "^6.0.0", 731 + "vfile": "^6.0.0" 732 + } 733 + }, 734 + "node_modules/@myriaddreamin/typst-ts-node-compiler": { 735 + "version": "0.5.0-rc8", 736 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler/-/typst-ts-node-compiler-0.5.0-rc8.tgz", 737 + "integrity": "sha512-RpMkKYyH7DDJwfX4hMhCkCbby5+rU7UMqRbCe6jmkvrW+FhW5YDxATYnRVEQLgRjbLwGDV5bECLr2/9no+Tn7A==", 738 + "license": "Apache-2.0", 739 + "engines": { 740 + "node": ">= 10" 741 + }, 742 + "optionalDependencies": { 743 + "@myriaddreamin/typst-ts-node-compiler-android-arm-eabi": "0.5.0-rc8", 744 + "@myriaddreamin/typst-ts-node-compiler-android-arm64": "0.5.0-rc8", 745 + "@myriaddreamin/typst-ts-node-compiler-darwin-arm64": "0.5.0-rc8", 746 + "@myriaddreamin/typst-ts-node-compiler-darwin-x64": "0.5.0-rc8", 747 + "@myriaddreamin/typst-ts-node-compiler-linux-arm-gnueabihf": "0.5.0-rc8", 748 + "@myriaddreamin/typst-ts-node-compiler-linux-arm64-gnu": "0.5.0-rc8", 749 + "@myriaddreamin/typst-ts-node-compiler-linux-arm64-musl": "0.5.0-rc8", 750 + "@myriaddreamin/typst-ts-node-compiler-linux-x64-gnu": "0.5.0-rc8", 751 + "@myriaddreamin/typst-ts-node-compiler-linux-x64-musl": "0.5.0-rc8", 752 + "@myriaddreamin/typst-ts-node-compiler-win32-arm64-msvc": "0.5.0-rc8", 753 + "@myriaddreamin/typst-ts-node-compiler-win32-x64-msvc": "0.5.0-rc8" 754 + } 755 + }, 756 + "node_modules/@myriaddreamin/typst-ts-node-compiler-android-arm-eabi": { 757 + "version": "0.5.0-rc8", 758 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-android-arm-eabi/-/typst-ts-node-compiler-android-arm-eabi-0.5.0-rc8.tgz", 759 + "integrity": "sha512-gSd1Nw4FNGixQTRo4isntK2Utupu4yfKRMTgmB6aLn57GVf6Z6NDA4YLw0lQ8dNB4OYceX1wMXmjnoLZGiTk6Q==", 760 + "cpu": [ 761 + "arm" 762 + ], 763 + "license": "Apache-2.0", 764 + "optional": true, 765 + "os": [ 766 + "android" 767 + ], 768 + "engines": { 769 + "node": ">= 10" 770 + } 771 + }, 772 + "node_modules/@myriaddreamin/typst-ts-node-compiler-android-arm64": { 773 + "version": "0.5.0-rc8", 774 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-android-arm64/-/typst-ts-node-compiler-android-arm64-0.5.0-rc8.tgz", 775 + "integrity": "sha512-1eSqCcLASxbdcicxFtYoXrBz4Rm7uhhWu/0DQ8Qo7bvNkzHuRtc4KkyuCZ6NCb/WzWuR4He20ySJZJRZurpgOQ==", 776 + "cpu": [ 777 + "arm64" 778 + ], 779 + "license": "Apache-2.0", 780 + "optional": true, 781 + "os": [ 782 + "android" 783 + ], 784 + "engines": { 785 + "node": ">= 10" 786 + } 787 + }, 788 + "node_modules/@myriaddreamin/typst-ts-node-compiler-darwin-arm64": { 789 + "version": "0.5.0-rc8", 790 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-darwin-arm64/-/typst-ts-node-compiler-darwin-arm64-0.5.0-rc8.tgz", 791 + "integrity": "sha512-KKty+9lpfzogptuQs78JaFLijucrIdUxnYrCqWR2wHTgc0rnQaqHyec0HQ0oApNDc6u59xURebglQ/nHAVa+WQ==", 792 + "cpu": [ 793 + "arm64" 794 + ], 795 + "license": "Apache-2.0", 796 + "optional": true, 797 + "os": [ 798 + "darwin" 799 + ], 800 + "engines": { 801 + "node": ">= 10" 802 + } 803 + }, 804 + "node_modules/@myriaddreamin/typst-ts-node-compiler-darwin-x64": { 805 + "version": "0.5.0-rc8", 806 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-darwin-x64/-/typst-ts-node-compiler-darwin-x64-0.5.0-rc8.tgz", 807 + "integrity": "sha512-e1P7GkyBV34h9eTDceZDC3qC0stDSN30R1gbZyniHOWu+qIKp0+RgQOLbkMj1Bk+vsOYGtb3zlqRJGEOCImz8w==", 808 + "cpu": [ 809 + "x64" 810 + ], 811 + "license": "Apache-2.0", 812 + "optional": true, 813 + "os": [ 814 + "darwin" 815 + ], 816 + "engines": { 817 + "node": ">= 10" 818 + } 819 + }, 820 + "node_modules/@myriaddreamin/typst-ts-node-compiler-linux-arm-gnueabihf": { 821 + "version": "0.5.0-rc8", 822 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-linux-arm-gnueabihf/-/typst-ts-node-compiler-linux-arm-gnueabihf-0.5.0-rc8.tgz", 823 + "integrity": "sha512-HX19C6kWO8aeg+Ki4pQm2TTmYYLZEW653QwZEoCluAlX7O5HoGxCbsFLnE7v3+ag1dwBcoI2oH5czuKLI7GRvA==", 824 + "cpu": [ 825 + "arm" 826 + ], 827 + "license": "Apache-2.0", 828 + "optional": true, 829 + "os": [ 830 + "linux" 831 + ], 832 + "engines": { 833 + "node": ">= 10" 834 + } 835 + }, 836 + "node_modules/@myriaddreamin/typst-ts-node-compiler-linux-arm64-gnu": { 837 + "version": "0.5.0-rc8", 838 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-linux-arm64-gnu/-/typst-ts-node-compiler-linux-arm64-gnu-0.5.0-rc8.tgz", 839 + "integrity": "sha512-ElCka7rGGnB5nmY/Ei6fhS8JWNFRJDTagW1NM2feGvEazpMxDOQDWPg/bUXnUp7RS68L67gyXJSNFlHNWJM6/w==", 840 + "cpu": [ 841 + "arm64" 842 + ], 843 + "license": "Apache-2.0", 844 + "optional": true, 845 + "os": [ 846 + "linux" 847 + ], 848 + "engines": { 849 + "node": ">= 10" 850 + } 851 + }, 852 + "node_modules/@myriaddreamin/typst-ts-node-compiler-linux-arm64-musl": { 853 + "version": "0.5.0-rc8", 854 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-linux-arm64-musl/-/typst-ts-node-compiler-linux-arm64-musl-0.5.0-rc8.tgz", 855 + "integrity": "sha512-RbaI/i0rVzu2fyCcUPj89Zt/kmpHqJvxS/VRtbXR6xjXBUBisheRLvmWJrDdMMLf2mS0cwRPxQHGKCOSmB6U5A==", 856 + "cpu": [ 857 + "arm64" 858 + ], 859 + "license": "Apache-2.0", 860 + "optional": true, 861 + "os": [ 862 + "linux" 863 + ], 864 + "engines": { 865 + "node": ">= 10" 866 + } 867 + }, 868 + "node_modules/@myriaddreamin/typst-ts-node-compiler-linux-x64-gnu": { 869 + "version": "0.5.0-rc8", 870 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-linux-x64-gnu/-/typst-ts-node-compiler-linux-x64-gnu-0.5.0-rc8.tgz", 871 + "integrity": "sha512-Mi2TruUZ97ZP920fMdvebRVYfMBxQZXnt14f0CqCy4tmg9sI7/ymBaGhT0vIo7A01cWr1DeTtoE4qUrOzXcDyA==", 872 + "cpu": [ 873 + "x64" 874 + ], 875 + "license": "Apache-2.0", 876 + "optional": true, 877 + "os": [ 878 + "linux" 879 + ], 880 + "engines": { 881 + "node": ">= 10" 882 + } 883 + }, 884 + "node_modules/@myriaddreamin/typst-ts-node-compiler-linux-x64-musl": { 885 + "version": "0.5.0-rc8", 886 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-linux-x64-musl/-/typst-ts-node-compiler-linux-x64-musl-0.5.0-rc8.tgz", 887 + "integrity": "sha512-I/GTNDl3Pb9/TyBRPtJqXuykkZ3d07PrSxnUKo1CelpJCk6S3h1BY0vl/3OwpENWGzy0FJehzkF0F8//3XzCgg==", 888 + "cpu": [ 889 + "x64" 890 + ], 891 + "license": "Apache-2.0", 892 + "optional": true, 893 + "os": [ 894 + "linux" 895 + ], 896 + "engines": { 897 + "node": ">= 10" 898 + } 899 + }, 900 + "node_modules/@myriaddreamin/typst-ts-node-compiler-win32-arm64-msvc": { 901 + "version": "0.5.0-rc8", 902 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-win32-arm64-msvc/-/typst-ts-node-compiler-win32-arm64-msvc-0.5.0-rc8.tgz", 903 + "integrity": "sha512-G0c+IqUDPdUDnTKyFl1ajf47oGgV1asc3aYtl23U71RK4R0ILnyycgGjE/5E8hD0CLodq5xMV+zW+17TZ4VX0A==", 904 + "cpu": [ 905 + "arm64" 906 + ], 907 + "license": "Apache-2.0", 908 + "optional": true, 909 + "os": [ 910 + "win32" 911 + ], 912 + "engines": { 913 + "node": ">= 10" 914 + } 915 + }, 916 + "node_modules/@myriaddreamin/typst-ts-node-compiler-win32-x64-msvc": { 917 + "version": "0.5.0-rc8", 918 + "resolved": "https://registry.npmjs.org/@myriaddreamin/typst-ts-node-compiler-win32-x64-msvc/-/typst-ts-node-compiler-win32-x64-msvc-0.5.0-rc8.tgz", 919 + "integrity": "sha512-qlZXCfLDUm1btpESBa4onU2ky7ALwdj369dAmgslNKyOl5JN8RYcyf9Hm7fp8WeVlxVjH2/2zJgPysAHf+SSRw==", 920 + "cpu": [ 921 + "x64" 922 + ], 923 + "license": "Apache-2.0", 924 + "optional": true, 925 + "os": [ 926 + "win32" 927 + ], 928 + "engines": { 929 + "node": ">= 10" 930 + } 931 + }, 717 932 "node_modules/@napi-rs/simple-git": { 718 933 "version": "0.1.19", 719 934 "resolved": "https://registry.npmjs.org/@napi-rs/simple-git/-/simple-git-0.1.19.tgz", ··· 3956 4171 "url": "https://opencollective.com/unified" 3957 4172 } 3958 4173 }, 3959 - "node_modules/mdast-util-find-and-replace/node_modules/@types/unist": { 3960 - "version": "3.0.2", 3961 - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 3962 - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 3963 - }, 3964 - "node_modules/mdast-util-find-and-replace/node_modules/unist-util-is": { 3965 - "version": "6.0.0", 3966 - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 3967 - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 3968 - "dependencies": { 3969 - "@types/unist": "^3.0.0" 3970 - }, 3971 - "funding": { 3972 - "type": "opencollective", 3973 - "url": "https://opencollective.com/unified" 3974 - } 3975 - }, 3976 - "node_modules/mdast-util-find-and-replace/node_modules/unist-util-visit-parents": { 3977 - "version": "6.0.1", 3978 - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", 3979 - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", 3980 - "dependencies": { 3981 - "@types/unist": "^3.0.0", 3982 - "unist-util-is": "^6.0.0" 3983 - }, 3984 - "funding": { 3985 - "type": "opencollective", 3986 - "url": "https://opencollective.com/unified" 3987 - } 3988 - }, 3989 4174 "node_modules/mdast-util-from-markdown": { 3990 4175 "version": "2.0.0", 3991 4176 "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz", ··· 4264 4449 "dependencies": { 4265 4450 "@types/mdast": "^4.0.0", 4266 4451 "unist-util-is": "^6.0.0" 4267 - }, 4268 - "funding": { 4269 - "type": "opencollective", 4270 - "url": "https://opencollective.com/unified" 4271 - } 4272 - }, 4273 - "node_modules/mdast-util-phrasing/node_modules/@types/unist": { 4274 - "version": "3.0.2", 4275 - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 4276 - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 4277 - }, 4278 - "node_modules/mdast-util-phrasing/node_modules/unist-util-is": { 4279 - "version": "6.0.0", 4280 - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 4281 - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 4282 - "dependencies": { 4283 - "@types/unist": "^3.0.0" 4284 4452 }, 4285 4453 "funding": { 4286 4454 "type": "opencollective", ··· 5474 5642 "url": "https://opencollective.com/unified" 5475 5643 } 5476 5644 }, 5477 - "node_modules/rehype-katex/node_modules/@types/unist": { 5478 - "version": "3.0.2", 5479 - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 5480 - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 5481 - }, 5482 - "node_modules/rehype-katex/node_modules/unist-util-is": { 5483 - "version": "6.0.0", 5484 - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 5485 - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 5486 - "dependencies": { 5487 - "@types/unist": "^3.0.0" 5488 - }, 5489 - "funding": { 5490 - "type": "opencollective", 5491 - "url": "https://opencollective.com/unified" 5492 - } 5493 - }, 5494 - "node_modules/rehype-katex/node_modules/unist-util-visit-parents": { 5495 - "version": "6.0.1", 5496 - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", 5497 - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", 5498 - "dependencies": { 5499 - "@types/unist": "^3.0.0", 5500 - "unist-util-is": "^6.0.0" 5501 - }, 5502 - "funding": { 5503 - "type": "opencollective", 5504 - "url": "https://opencollective.com/unified" 5505 - } 5506 - }, 5507 5645 "node_modules/rehype-mathjax": { 5508 5646 "version": "6.0.0", 5509 5647 "resolved": "https://registry.npmjs.org/rehype-mathjax/-/rehype-mathjax-6.0.0.tgz", ··· 5517 5655 "mathjax-full": "^3.0.0", 5518 5656 "unified": "^11.0.0", 5519 5657 "unist-util-visit-parents": "^6.0.0" 5520 - }, 5521 - "funding": { 5522 - "type": "opencollective", 5523 - "url": "https://opencollective.com/unified" 5524 - } 5525 - }, 5526 - "node_modules/rehype-mathjax/node_modules/@types/unist": { 5527 - "version": "3.0.2", 5528 - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 5529 - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 5530 - }, 5531 - "node_modules/rehype-mathjax/node_modules/unist-util-is": { 5532 - "version": "6.0.0", 5533 - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 5534 - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 5535 - "dependencies": { 5536 - "@types/unist": "^3.0.0" 5537 - }, 5538 - "funding": { 5539 - "type": "opencollective", 5540 - "url": "https://opencollective.com/unified" 5541 - } 5542 - }, 5543 - "node_modules/rehype-mathjax/node_modules/unist-util-visit-parents": { 5544 - "version": "6.0.1", 5545 - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", 5546 - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", 5547 - "dependencies": { 5548 - "@types/unist": "^3.0.0", 5549 - "unist-util-is": "^6.0.0" 5550 5658 }, 5551 5659 "funding": { 5552 5660 "type": "opencollective", ··· 7285 7393 "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 7286 7394 "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 7287 7395 }, 7288 - "node_modules/unist-util-find-after/node_modules/unist-util-is": { 7396 + "node_modules/unist-util-is": { 7289 7397 "version": "6.0.0", 7290 7398 "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 7291 7399 "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 7400 + "license": "MIT", 7292 7401 "dependencies": { 7293 7402 "@types/unist": "^3.0.0" 7294 7403 }, ··· 7296 7405 "type": "opencollective", 7297 7406 "url": "https://opencollective.com/unified" 7298 7407 } 7408 + }, 7409 + "node_modules/unist-util-is/node_modules/@types/unist": { 7410 + "version": "3.0.3", 7411 + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", 7412 + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", 7413 + "license": "MIT" 7299 7414 }, 7300 7415 "node_modules/unist-util-modify-children": { 7301 7416 "version": "4.0.0", ··· 7381 7496 "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 7382 7497 "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 7383 7498 }, 7384 - "node_modules/unist-util-visit/node_modules/@types/unist": { 7385 - "version": "3.0.2", 7386 - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 7387 - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 7388 - }, 7389 - "node_modules/unist-util-visit/node_modules/unist-util-is": { 7390 - "version": "6.0.0", 7391 - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", 7392 - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", 7393 - "dependencies": { 7394 - "@types/unist": "^3.0.0" 7395 - }, 7396 - "funding": { 7397 - "type": "opencollective", 7398 - "url": "https://opencollective.com/unified" 7399 - } 7400 - }, 7401 - "node_modules/unist-util-visit/node_modules/unist-util-visit-parents": { 7499 + "node_modules/unist-util-visit-parents": { 7402 7500 "version": "6.0.1", 7403 7501 "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", 7404 7502 "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", 7503 + "license": "MIT", 7405 7504 "dependencies": { 7406 7505 "@types/unist": "^3.0.0", 7407 7506 "unist-util-is": "^6.0.0" ··· 7410 7509 "type": "opencollective", 7411 7510 "url": "https://opencollective.com/unified" 7412 7511 } 7512 + }, 7513 + "node_modules/unist-util-visit-parents/node_modules/@types/unist": { 7514 + "version": "3.0.3", 7515 + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", 7516 + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", 7517 + "license": "MIT" 7518 + }, 7519 + "node_modules/unist-util-visit/node_modules/@types/unist": { 7520 + "version": "3.0.2", 7521 + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", 7522 + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" 7413 7523 }, 7414 7524 "node_modules/universalify": { 7415 7525 "version": "0.2.0",
+1
package.json
··· 37 37 "dependencies": { 38 38 "@clack/prompts": "^0.7.0", 39 39 "@floating-ui/dom": "^1.6.12", 40 + "@myriaddreamin/rehype-typst": "^0.5.0-rc7", 40 41 "@napi-rs/simple-git": "0.1.19", 41 42 "@tweenjs/tween.js": "^25.0.0", 42 43 "async-mutex": "^0.5.0",
+38 -24
quartz/plugins/transformers/latex.ts
··· 1 1 import remarkMath from "remark-math" 2 2 import rehypeKatex from "rehype-katex" 3 3 import rehypeMathjax from "rehype-mathjax/svg" 4 + //@ts-ignore 5 + import rehypeTypst from "@myriaddreamin/rehype-typst" 4 6 import { QuartzTransformerPlugin } from "../types" 7 + import { KatexOptions } from "katex" 8 + import { Options as MathjaxOptions } from "rehype-mathjax/svg" 9 + //@ts-ignore 10 + import { Options as TypstOptions } from "@myriaddreamin/rehype-typst" 5 11 6 12 interface Options { 7 - renderEngine: "katex" | "mathjax" 13 + renderEngine: "katex" | "mathjax" | "typst" 8 14 customMacros: MacroType 15 + katexOptions: Omit<KatexOptions, "macros" | "output"> 16 + mathJaxOptions: Omit<MathjaxOptions, "macros"> 17 + typstOptions: TypstOptions 9 18 } 10 19 11 20 interface MacroType { ··· 21 30 return [remarkMath] 22 31 }, 23 32 htmlPlugins() { 24 - if (engine === "katex") { 25 - return [[rehypeKatex, { output: "html", macros }]] 26 - } else { 27 - return [[rehypeMathjax, { macros }]] 33 + switch (engine) { 34 + case "katex": { 35 + return [[rehypeKatex, { output: "html", macros, ...(opts?.katexOptions ?? {}) }]] 36 + } 37 + case "typst": { 38 + return [[rehypeTypst, opts?.typstOptions ?? {}]] 39 + } 40 + case "mathjax": { 41 + return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] 42 + } 43 + default: { 44 + return [[rehypeMathjax, { macros, ...(opts?.mathJaxOptions ?? {}) }]] 45 + } 28 46 } 29 47 }, 30 48 externalResources() { 31 - if (engine === "katex") { 32 - return { 33 - css: [ 34 - { 35 - // base css 36 - content: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css", 37 - }, 38 - ], 39 - js: [ 40 - { 41 - // fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md 42 - src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js", 43 - loadTime: "afterDOMReady", 44 - contentType: "external", 45 - }, 46 - ], 47 - } 48 - } else { 49 - return {} 49 + switch (engine) { 50 + case "katex": 51 + return { 52 + css: [{ content: "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" }], 53 + js: [ 54 + { 55 + // fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md 56 + src: "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js", 57 + loadTime: "afterDOMReady", 58 + contentType: "external", 59 + }, 60 + ], 61 + } 62 + default: 63 + return { css: [], js: [] } 50 64 } 51 65 }, 52 66 }