Changes
10 changed files (+119/-3)
-
-
@@ -4,6 +4,7 @@ // SPDX-License-Identifier: Apache-2.0import type { Extension } from "../../deps/esm.sh/mdast-util-from-markdown/mod.ts"; import { gfmFromMarkdown } from "../../deps/esm.sh/mdast-util-gfm/mod.ts"; import { mathFromMarkdown } from "../../deps/esm.sh/mdast-util-math/mod.ts"; import { ofmCommentFromMarkdown,
-
@@ -25,6 +26,7 @@export function ofmFromMarkdown(): Extension[] { return [ ...gfmFromMarkdown(), mathFromMarkdown(), ofmCommentFromMarkdown(), ofmHighlightFromMarkdown(), ofmWikilinkFromMarkdown(),
-
-
-
@@ -11,6 +11,10 @@ gfm,gfmHtml, type HtmlOptions, } from "../../deps/esm.sh/micromark-extension-gfm/mod.ts"; import { math, mathHtml, } from "../../deps/esm.sh/micromark-extension-math/mod.ts"; import { ofmComment,
-
@@ -36,6 +40,7 @@ ofmComment(),ofmWikilink(), ofmHighlight(), gfm(), math(), ]); }
-
@@ -54,5 +59,6 @@ ofmCommentHtml({ preserveAsHtmlComment: preserveComment }),ofmHighlightHtml(), ofmWikilinkHtml(), gfmHtml(rest), mathHtml(), ]); }
-
-
-
@@ -228,6 +228,8 @@ "https://esm.sh/v135/is-alphabetical@2.0.1/denonext/is-alphabetical.mjs": "d0feb3b8b248c1c89544825a12db253946e94532c3ba2df47c5ce9ed06a10242","https://esm.sh/v135/is-alphanumerical@2.0.1/denonext/is-alphanumerical.mjs": "978a2d980f37c9b42b82e6dc915455d43a9ba5f7d11c6f314d5ef5694ed9427e", "https://esm.sh/v135/is-decimal@2.0.1/denonext/is-decimal.mjs": "d58375f587816fc947898747f8e6986158dec29151c185e7a510641b17668e46", "https://esm.sh/v135/is-hexadecimal@2.0.1/denonext/is-hexadecimal.mjs": "7e5d0abd99e5d66839f55c05df59e144465bfa47ce974815557481d53d6fd919", "https://esm.sh/v135/katex@0.16.10/denonext/katex.mjs": "caf72dc45c0951b7c0a6602f5e49e990119bde2e4819b1f7ed137a4111c94e5f", "https://esm.sh/v135/katex@0.16.9/denonext/katex.mjs": "75be3261500b25dca3df7a2dbcd2454fe9924242f2ad348fb5f875643e39c186", "https://esm.sh/v135/longest-streak@3.1.0/denonext/longest-streak.mjs": "97b1d8c42d407e285971fea218d89a0404270c3b841a26ec62b83f62450ad573", "https://esm.sh/v135/markdown-table@3.0.3/denonext/markdown-table.mjs": "1dd9cb2d2d95fc440cc10489ac77bf979c944e76070997d962e05f627f45df0e", "https://esm.sh/v135/mdast-util-definitions@6.0.0": "b335a17ac86505677a62667dd26fecddb8e94a8629c3193220655ccfd6c50081",
-
@@ -242,6 +244,8 @@ "https://esm.sh/v135/mdast-util-gfm-table@2.0.0/denonext/mdast-util-gfm-table.mjs": "03566441d8a21a76264c54db7f47de32a231296a8774e155d3de9e0a63468638","https://esm.sh/v135/mdast-util-gfm-task-list-item@2.0.0/denonext/mdast-util-gfm-task-list-item.mjs": "a2542fbdb27957f27c170055b85feda34b48d38884afe7f565713f3cc2503301", "https://esm.sh/v135/mdast-util-gfm@3.0.0": "0bef9ce3d7db5662f2a43ba8c34586323d295eb9bde1db802ad9015ceb3c843e", "https://esm.sh/v135/mdast-util-gfm@3.0.0/denonext/mdast-util-gfm.mjs": "0a06fd1def4aadb5defc7f631f6c1d23f8598d57233cba19d4618229db70b10a", "https://esm.sh/v135/mdast-util-math@3.0.0": "d2479bf44348aaf25af1254ec06cf939b5351a8a5de4ded75d2250b8e53911d0", "https://esm.sh/v135/mdast-util-math@3.0.0/denonext/mdast-util-math.mjs": "1ad4d48cda514289bbda9ace4f2b8af3f7e246f3df3f1b4ab802638919dfd0bf", "https://esm.sh/v135/mdast-util-phrasing@4.0.0/denonext/mdast-util-phrasing.mjs": "ed30057d1949bdde664291eaa5e11ea8c765f573a5c38eba60b099ffd3612f42", "https://esm.sh/v135/mdast-util-to-hast@13.1.0": "3a712fec5d7f4696ec135556925c8c2f7480b21dc39bd96077550d06220d2ba8", "https://esm.sh/v135/mdast-util-to-hast@13.1.0/denonext/mdast-util-to-hast.mjs": "e6ab97ff3f6c94f6c7ccaba485dac8a4fdd5edae1b311ae295b409b462ff5001",
-
@@ -256,6 +260,8 @@ "https://esm.sh/v135/micromark-extension-gfm-tagfilter@2.0.0/denonext/micromark-extension-gfm-tagfilter.mjs": "6e6faebfc624e00c5af52026393372174a7415aab2bc1d7cc16f2541f2977ba3","https://esm.sh/v135/micromark-extension-gfm-task-list-item@2.0.1/denonext/micromark-extension-gfm-task-list-item.mjs": "575d12647ea051e013593a551391a854e5b4dd69d6c594b20d8ec2a46fbbd7a1", "https://esm.sh/v135/micromark-extension-gfm@3.0.0": "7a25f597838e5849b3f542c9973c1147720cf0669d25d5c43ce37f2524acb079", "https://esm.sh/v135/micromark-extension-gfm@3.0.0/denonext/micromark-extension-gfm.mjs": "eaa65f2159d1e1eb993fec61d40c79ef55068d6fa8da92bbfa34259d10011112", "https://esm.sh/v135/micromark-extension-math@3.0.0": "63d593c47fd1b1ab82937d24ef0e6582ca401384d2f63d22ff7718784d76e3ed", "https://esm.sh/v135/micromark-extension-math@3.0.0/denonext/micromark-extension-math.mjs": "6ed72c1637cd8b2d0cd4fbf6fae1fca0f38c17b43db03728ca086631550a12ad", "https://esm.sh/v135/micromark-factory-destination@2.0.0/denonext/micromark-factory-destination.mjs": "84dadab4182836ff8c4437e9a384a6e3488496848641c9868334d8a6b7658331", "https://esm.sh/v135/micromark-factory-label@2.0.0/denonext/micromark-factory-label.mjs": "0d4877dbb95c2bf635d48d8d44a243ab0c6830f68c76289c9d92730871b88170", "https://esm.sh/v135/micromark-factory-space@2.0.0/denonext/micromark-factory-space.mjs": "1ac7c90dec53f7f634767c5470c2dcf204f4df99ec318a27832786153d5c8110",
-
@@ -592,6 +598,10 @@ "https://esm.sh/v135/refractor@4.8.1/denonext/lib/core.js": "388b70847fd55fbd1063166d45d2a327f7ad3a113c79d30c1d52017a7266b69d","https://esm.sh/v135/space-separated-tokens@2.0.2/denonext/space-separated-tokens.mjs": "f30773a9959cacfe7511c250e5d125a9f88ee00d3aef6e87b4d17fe49806b276", "https://esm.sh/v135/stringify-entities@4.0.3/denonext/stringify-entities.mjs": "379aaecccdf6a05e9725a5eff4de4fa61193f0a793ddacaa1033f071bd0e2842", "https://esm.sh/v135/stringify-entities@4.0.4/denonext/stringify-entities.mjs": "dc80c6c09409f443a2f6eb08b9712ce2887c1d0a475c17b5634b39af739c098d", "https://esm.sh/v135/temml@0.10.24": "94a01db5da23c881c2c54f9bf112d319c68d7ec3cc23fe1ffc980bacb2a7c466", "https://esm.sh/v135/temml@0.10.24/denonext/dist/temml.js": "afbf78726dea9ca3a016f1fa69db100535f4ad819bc2c637be4f304d9ffb6551", "https://esm.sh/v135/temml@0.10.24/denonext/temml.mjs": "bfe9e77bf34fe3ed54c31e2662e632c54f53b576a53efc9b60d57bbe9ccd830b", "https://esm.sh/v135/temml@0.10.24/dist/temml.mjs": "ee16ff1f4c69b9df8ada84d5800536f3ab620098918b8100262df773f248b509", "https://esm.sh/v135/trim-lines@3.0.1/denonext/trim-lines.mjs": "f01a20253341eb2554f307ab05bc9cd93d6f33bcbb24fde2fc9fcd857564283e", "https://esm.sh/v135/unist-util-is@6.0.0/denonext/unist-util-is.mjs": "d92da46b3a1084450f150cc06c02f3bf85b93ab4c4b43a960d72a4f5678e95cc", "https://esm.sh/v135/unist-util-position@5.0.0/denonext/unist-util-position.mjs": "aaef05774a54f2b84400e98325219e2ba6cf966e318173bcd895647c56bb8871",
-
-
-
@@ -0,0 +1,5 @@// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com> // // SPDX-License-Identifier: Apache-2.0 export * from "https://esm.sh/v135/mdast-util-math@3.0.0";
-
-
-
@@ -0,0 +1,5 @@// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com> // // SPDX-License-Identifier: Apache-2.0 export * from "https://esm.sh/v135/micromark-extension-math@3.0.0";
-
-
deps/esm.sh/temml/mod.ts (new)
-
@@ -0,0 +1,7 @@// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com> // // SPDX-License-Identifier: Apache-2.0 import temml from "https://esm.sh/v135/temml@0.10.24/dist/temml.mjs"; export default temml;
-
-
-
@@ -13,7 +13,7 @@ - [x] Footnotes- [x] Autolinks - [x] Tables - [ ] Diagrams (Mermaid) ... Maybe no support, as Mermaid's overall quality is questionable. - [ ] MathJax ... No support if it can't generate MathML at build time. - [x] Math ... ~No support if MathJax can't generate MathML at build time.~ Using Temml instead. - [x] Syntax Highlighting - [ ] Obsidian Extensions - [x] Internal Link path resolution
-
-
-
@@ -57,4 +57,28 @@   ![[dog.jpg|64]] ![[dog.jpg|64]] ## Math extension (LaTeX) Macana parses math notations using [Temml](https://temml.org/). It converts LaTeX notation to MathML, which browsers natively support without JavaScript. ```markdown This is an inline math expression $e^{2i\pi} = 1$. ``` This is an inline math expression $e^{2i\pi} = 1$. ```markdown $$ \begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc $$ ``` $$ \begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc $$
-
-
-
@@ -0,0 +1,39 @@// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com> // // SPDX-License-Identifier: Apache-2.0 import type * as Hast from "../../../deps/esm.sh/hast/types.ts"; import type * as Mdast from "../../../deps/esm.sh/mdast/types.ts"; import { type Raw } from "../../../deps/esm.sh/mdast-util-to-hast/mod.ts"; import { type InlineMath, type Math, } from "../../../deps/esm.sh/mdast-util-math/mod.ts"; import temml from "../../../deps/esm.sh/temml/mod.ts"; import { type Handlers, type State, } from "../../../deps/esm.sh/mdast-util-to-hast/mod.ts"; export function mathHandlers(): Handlers { return { // @ts-expect-error: unist-related libraries heavily relies on ambient module declarations, // which Deno does not support. APIs also don't accept type parameters. math(_state: State, node: Math & Mdast.Literal): Raw & Hast.Literal { return { type: "raw", value: temml.renderToString(node.value), }; }, inlineMath( _state: State, node: InlineMath & Mdast.Literal, ): Raw & Hast.Literal { return { type: "raw", value: temml.renderToString(node.value), }; }, }; }
-
-
-
@@ -18,6 +18,7 @@ import { css, join as joinCss } from "../css.ts";import { calloutHandlers, calloutStyles } from "./callout.tsx"; import { listHandlers, listStyles } from "./list.tsx"; import { mathHandlers } from "./math.ts"; const enum C { Wrapper = "fm--m",
-
@@ -184,9 +185,25 @@ }:where(.${C.Wrapper}) img:not(:first-child) { margin-top: calc(var(--baseline) * 1rem); } :where(.${C.Wrapper}) > math { display: block; margin-top: calc(var(--baseline) * 1rem); } @supports (display: math) { :where(.${C.Wrapper}) > math { display: math; width: 100%; } } `; export const fromMdastStyles = joinCss(ownStyles, calloutStyles, listStyles); export const fromMdastStyles = joinCss( ownStyles, calloutStyles, listStyles, ); export function fromMdast(mdast: Mdast.Nodes): Hast.Nodes { return ofmHtml(toHast(mdast, {
-
@@ -195,6 +212,7 @@ ...ofmToHastHandlers(),...calloutHandlers(), ...listHandlers(), ...syntaxHighlightingHandlers(), ...mathHandlers(), }, allowDangerousHtml: true, }));
-