From d4fe0254375e99d00bfaf7201a6cfdf9f2d16393 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Fri, 5 Apr 2024 10:34:32 -0500 Subject: [PATCH] typst --- .build.yml | 1 + astro.config.ts | 11 +- package.json | 1 + plugin/remark-admonitions.ts | 118 +++++----- plugin/remark-agda.ts | 14 +- plugin/remark-reading-time.ts | 2 +- plugin/remark-typst.ts | 42 ++++ pnpm-lock.yaml | 320 +++++++++++++++++++++++++-- src/content/posts/2024-04-04-test.md | 36 +++ 9 files changed, 459 insertions(+), 86 deletions(-) create mode 100644 plugin/remark-typst.ts create mode 100644 src/content/posts/2024-04-04-test.md diff --git a/.build.yml b/.build.yml index cced875..62cb78c 100644 --- a/.build.yml +++ b/.build.yml @@ -4,6 +4,7 @@ packages: - hut - npm - rsync + - typst environment: site: mzhang.io secrets: diff --git a/astro.config.ts b/astro.config.ts index 0a8f389..e00c05e 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -10,6 +10,7 @@ import remarkDescription from "astro-remark-description"; import remarkAdmonitions from "./plugin/remark-admonitions"; import remarkMath from "remark-math"; import rehypeKatex from "rehype-katex"; +import remarkTypst from "./plugin/remark-typst"; // import addProofMacros from "./utils/mzproofs"; // import remarkAgda from "./plugin/remark-agda"; @@ -20,7 +21,6 @@ export default defineConfig({ integrations: [ mdx(), sitemap(), - //astroImageTools ], markdown: { syntaxHighlight: "shiki", @@ -28,19 +28,14 @@ export default defineConfig({ remarkPlugins: [ remarkAdmonitions, remarkReadingTime, - // remarkAgda, + remarkTypst, [remarkMath, {}], remarkMermaid, emoji, [remarkDescription, { name: "excerpt" }], ], rehypePlugins: [ - [ - rehypeKatex, - { - // macros: addProofMacros({}) - }, - ], + [rehypeKatex, {}], rehypeAccessibleEmojis, ], }, diff --git a/package.json b/package.json index 06ee0e7..bd0ae93 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "format": "prettier -w ." }, "dependencies": { + "@astrojs/markdown-remark": "^5.0.0", "@astrojs/mdx": "^1.0.0", "@astrojs/rss": "^3.0.0", "@astrojs/sitemap": "^3.0.0", diff --git a/plugin/remark-admonitions.ts b/plugin/remark-admonitions.ts index 856c9b9..4900a5f 100644 --- a/plugin/remark-admonitions.ts +++ b/plugin/remark-admonitions.ts @@ -7,88 +7,94 @@ import type { BuildVisitor } from "unist-util-visit"; import type { Blockquote, Paragraph, Text } from "mdast"; import type { RemarkPlugin } from "@astrojs/markdown-remark"; -const remarkAdmonitions: RemarkPlugin = function (providedConfig?: Partial) { - return (tree) => { +const remarkAdmonitions: RemarkPlugin = + (providedConfig?: Partial) => (tree) => { visit(tree, handleNode({ ...defaultConfig, ...providedConfig })); }; -}; export default remarkAdmonitions; -const handleNode = - (config: Config): BuildVisitor => - (node) => { - // Filter required elems - if (node.type != "blockquote") return; - const blockquote = node as Blockquote; +const handleNode = (config: Config): BuildVisitor => (node) => { + // Filter required elems + if (node.type != "blockquote") return; + const blockquote = node as Blockquote; - if (blockquote.children[0]?.type != "paragraph") return; + if (blockquote.children[0]?.type != "paragraph") return; - const paragraph = blockquote.children[0]; - if (paragraph.children[0]?.type != "text") return; + const paragraph = blockquote.children[0]; + if (paragraph.children[0]?.type != "text") return; - const text = paragraph.children[0]; + const text = paragraph.children[0]; - // A link break after the title is explicitly required by GitHub - const titleEnd = text.value.indexOf("\n"); - if (titleEnd < 0) return; + // A link break after the title is explicitly required by GitHub + const titleEnd = text.value.indexOf("\n"); + if (titleEnd < 0) return; - const textBody = text.value.substring(titleEnd + 1); - let title = text.value.substring(0, titleEnd); - // Handle whitespaces after the title. - // Whitespace characters are defined by GFM - const m = /[ \t\v\f\r]+$/.exec(title); - if (m && !config.titleKeepTrailingWhitespaces) { - title = title.substring(0, title.length - m[0].length); - } - if (!nameFilter(config.titleFilter)(title)) return; - const { displayTitle, checkedTitle } = config.titleTextMap(title); + const textBody = text.value.substring(titleEnd + 1); + let title = text.value.substring(0, titleEnd); + // Handle whitespaces after the title. + // Whitespace characters are defined by GFM + const m = /[ \t\v\f\r]+$/.exec(title); + if (m && !config.titleKeepTrailingWhitespaces) { + title = title.substring(0, title.length - m[0].length); + } + if (!nameFilter(config.titleFilter)(title)) return; + const { displayTitle, checkedTitle } = config.titleTextMap(title); - // Update the text body - text.value = textBody; + // Update the text body + text.value = textBody; - // Insert the title element and add classes for the title - const paragraphTitleText: Text = { type: "text", value: displayTitle }; - const paragraphTitle: Paragraph = { - type: "paragraph", - children: [paragraphTitleText], - data: config.dataMaps.title({ - hProperties: { className: classNameMap(config.classNameMaps.title)(checkedTitle) }, - }), - }; - blockquote.children.unshift(paragraphTitle); - - // Add classes for the block - blockquote.data = config.dataMaps.block({ - ...blockquote.data, - hProperties: { className: classNameMap(config.classNameMaps.block)(checkedTitle) }, - // The blockquote should be rendered as a div, which is explicitly required by GitHub - hName: "div", - }); + // Insert the title element and add classes for the title + const paragraphTitleText: Text = { type: "text", value: displayTitle }; + const paragraphTitle: Paragraph = { + type: "paragraph", + children: [paragraphTitleText], + data: config.dataMaps.title({ + hProperties: { + className: classNameMap(config.classNameMaps.title)(checkedTitle), + }, + }), }; + blockquote.children.unshift(paragraphTitle); + + // Add classes for the block + blockquote.data = config.dataMaps.block({ + ...blockquote.data, + hProperties: { + className: classNameMap(config.classNameMaps.block)(checkedTitle), + }, + // The blockquote should be rendered as a div, which is explicitly required by GitHub + hName: "div", + }); +}; export const mkdocsConfig: Partial = { classNameMaps: { block: (title) => [ "admonition", - ...(title.startsWith("admonition: ") ? title.substring("admonition: ".length) : title).split( - " ", - ), + ...(title.startsWith("admonition: ") + ? title.substring("admonition: ".length) + : title).split( + " ", + ), ], title: "admonition-title", }, titleFilter: (title) => (title.startsWith("[!admonition: ") && title.endsWith("]")) || - (Boolean(title.match(/^\[!(attention|caution|danger|error|hint|important|note|tip|warning)/)) && + (Boolean( + title.match( + /^\[!(attention|caution|danger|error|hint|important|note|tip|warning)/, + ), + ) && title.endsWith("]")), titleTextMap: (title) => { title = title.substring(2, title.length - 1); // ' "' will not occur in classes const i = title.indexOf(' "'); - const displayTitle = - i >= 0 - ? title.substring(i + 2, title.length - 1) // Display title is wrapped with "" - : ""; + const displayTitle = i >= 0 + ? title.substring(i + 2, title.length - 1) // Display title is wrapped with "" + : ""; const checkedTitle = title.substring(0, i); return { displayTitle, checkedTitle }; }, @@ -99,7 +105,9 @@ export interface Config { title: ClassNameMap; }; titleFilter: NameFilter; - titleTextMap: (title: string) => { displayTitle: string; checkedTitle: string }; + titleTextMap: ( + title: string, + ) => { displayTitle: string; checkedTitle: string }; dataMaps: { block: (data: Data) => Data; title: (data: Data) => Data; diff --git a/plugin/remark-agda.ts b/plugin/remark-agda.ts index 0675435..65a11c3 100644 --- a/plugin/remark-agda.ts +++ b/plugin/remark-agda.ts @@ -1,17 +1,17 @@ import type { RemarkPlugin } from "@astrojs/markdown-remark"; -import type { Node, Root, Parent, RootContent } from "hast"; +import type { Node, Parent, Root, RootContent } from "hast"; import { fromMarkdown } from "mdast-util-from-markdown"; import { fromHtml } from "hast-util-from-html"; import { toHtml } from "hast-util-to-html"; import { spawnSync } from "node:child_process"; -import { mkdtempSync, mkdirSync, readFileSync } from "node:fs"; +import { mkdirSync, mkdtempSync, readFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join, parse } from "node:path"; import { visit } from "unist-util-visit"; const remarkAgda: RemarkPlugin = () => { - return function (tree, { history }) { + return (tree, { history }) => { // console.log("args", arguments) const path: string = history[history.length - 1]; console.log("path", history); @@ -23,7 +23,13 @@ const remarkAgda: RemarkPlugin = () => { const childOutput = spawnSync( "agda", - ["--html", `--html-dir=${outDir}`, "--highlight-occurrences", "--html-highlight=code", path], + [ + "--html", + `--html-dir=${outDir}`, + "--highlight-occurrences", + "--html-highlight=code", + path, + ], {}, ); diff --git a/plugin/remark-reading-time.ts b/plugin/remark-reading-time.ts index efb0681..9664d65 100644 --- a/plugin/remark-reading-time.ts +++ b/plugin/remark-reading-time.ts @@ -3,7 +3,7 @@ import { toString } from "mdast-util-to-string"; import type { RemarkPlugin } from "@astrojs/markdown-remark"; const remarkReadingTime: RemarkPlugin = () => { - return function (tree, { data }) { + return (tree, { data }) => { const textOnPage = toString(tree); const readingTime = getReadingTime(textOnPage); diff --git a/plugin/remark-typst.ts b/plugin/remark-typst.ts new file mode 100644 index 0000000..2c8b7dd --- /dev/null +++ b/plugin/remark-typst.ts @@ -0,0 +1,42 @@ +import type { RemarkPlugin } from "@astrojs/markdown-remark"; +import { mkdtempSync, readFileSync, writeFileSync } from "node:fs"; +import { visit } from "unist-util-visit"; +import { join } from "node:path"; +import { spawnSync } from "node:child_process"; +import { tmpdir } from "node:os"; + +const remarkTypst: RemarkPlugin = () => { + const tmp = mkdtempSync(join(tmpdir(), "typst")); + let ctr = 0; + + return (tree) => { + visit( + tree, + (node) => node.type === "code" && node.lang === "typst", + (node, index, parent) => { + const doc = join(tmp, `${ctr}.typ`); + const docOut = join(tmp, `${ctr}.svg`); + ctr += 1; + + writeFileSync(doc, node.value); + const result = spawnSync( + "typst", + [ + "compile", + "--format", + "svg", + doc, + ], + {}, + ); + console.log("OUTPUT", result.stderr.toString()); + + const svgOut = readFileSync(docOut); + node.type = "html"; + node.value = svgOut.toString(); + }, + ); + }; +}; + +export default remarkTypst; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32c0b7e..00b6056 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@astrojs/markdown-remark': + specifier: ^5.0.0 + version: 5.0.0 '@astrojs/mdx': specifier: ^1.0.0 version: 1.1.1(astro@3.2.4) @@ -153,6 +156,31 @@ packages: - supports-color dev: false + /@astrojs/markdown-remark@5.0.0: + resolution: {integrity: sha512-QBXbxXZamVRoqCNN2gjDXa7qYPUkJZq7KYFfg3DX7rze3QL6xiz4N+Wg202dNPRaIkQa16BV6D8+EHibQFubRg==} + dependencies: + '@astrojs/prism': 3.0.0 + github-slugger: 2.0.0 + hast-util-from-html: 2.0.1 + hast-util-to-text: 4.0.0 + import-meta-resolve: 4.0.0 + mdast-util-definitions: 6.0.0 + rehype-raw: 7.0.0 + rehype-stringify: 10.0.0 + remark-gfm: 4.0.0 + remark-parse: 11.0.0 + remark-rehype: 11.1.0 + remark-smartypants: 2.0.0 + shiki: 1.2.4 + unified: 11.0.4 + unist-util-remove-position: 5.0.0 + unist-util-visit: 5.0.0 + unist-util-visit-parents: 6.0.1 + vfile: 6.0.1 + transitivePeerDependencies: + - supports-color + dev: false + /@astrojs/mdx@1.1.1(astro@3.2.4): resolution: {integrity: sha512-3dfL12ZqI6NCjx0iVOYVSyljlVgsxds5mOhe78xoCVjyqSpZZsxzz4Dt5WfGxDon2nc2bD6XGiZ2PIy8fmX6NQ==} engines: {node: '>=18.14.1'} @@ -1347,6 +1375,10 @@ packages: fastq: 1.15.0 dev: false + /@shikijs/core@1.2.4: + resolution: {integrity: sha512-ClaUWpt8oTzjcF0MM1P81AeWyzc1sNSJlAjMG80CbwqbFqXSNz+NpQVUC0icobt3sZn43Sn27M4pHD/Jmp3zHw==} + dev: false + /@sindresorhus/is@3.1.2: resolution: {integrity: sha512-JiX9vxoKMmu8Y3Zr2RVathBL1Cdu4Nt4MuNWemt1Nc06A0RAin9c5FArkhGsyMBWfCu4zj+9b+GxtjAnE4qqLQ==} engines: {node: '>=10'} @@ -2851,7 +2883,6 @@ packages: parse5: 7.1.2 vfile: 6.0.1 vfile-message: 4.0.2 - dev: true /hast-util-from-parse5@7.1.2: resolution: {integrity: sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==} @@ -2888,6 +2919,12 @@ packages: '@types/unist': 2.0.8 dev: false + /hast-util-is-element@3.0.0: + resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==} + dependencies: + '@types/hast': 3.0.1 + dev: false + /hast-util-parse-selector@3.1.1: resolution: {integrity: sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==} dependencies: @@ -3017,6 +3054,15 @@ packages: unist-util-find-after: 4.0.1 dev: false + /hast-util-to-text@4.0.0: + resolution: {integrity: sha512-EWiE1FSArNBPUo1cKWtzqgnuRQwEeQbQtnFJRYV1hb1BWDgrAlBU0ExptvZMM/KSA82cDpm2sFGf3Dmc5Mza3w==} + dependencies: + '@types/hast': 3.0.1 + '@types/unist': 3.0.0 + hast-util-is-element: 3.0.0 + unist-util-find-after: 5.0.0 + dev: false + /hast-util-whitespace@2.0.1: resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==} dev: false @@ -3118,6 +3164,10 @@ packages: resolution: {integrity: sha512-4IwhLhNNA8yy445rPjD/lWh++7hMDOml2eHtd58eG7h+qK3EryMuuRbsHGPikCoAgIkkDnckKfWSk2iDla/ejg==} dev: false + /import-meta-resolve@4.0.0: + resolution: {integrity: sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==} + dev: false + /inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} dependencies: @@ -3506,7 +3556,6 @@ packages: unist-util-stringify-position: 4.0.0 transitivePeerDependencies: - supports-color - dev: true /mdast-util-gfm-autolink-literal@1.0.3: resolution: {integrity: sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==} @@ -3517,6 +3566,16 @@ packages: micromark-util-character: 1.2.0 dev: false + /mdast-util-gfm-autolink-literal@2.0.0: + resolution: {integrity: sha512-FyzMsduZZHSc3i0Px3PQcBT4WJY/X/RCtEJKuybiC6sjPqLv7h1yqAkmILZtuxMSsUyaLUWNp71+vQH2zqp5cg==} + dependencies: + '@types/mdast': 4.0.1 + ccount: 2.0.1 + devlop: 1.1.0 + mdast-util-find-and-replace: 3.0.1 + micromark-util-character: 2.0.1 + dev: false + /mdast-util-gfm-footnote@1.0.2: resolution: {integrity: sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==} dependencies: @@ -3525,6 +3584,18 @@ packages: micromark-util-normalize-identifier: 1.1.0 dev: false + /mdast-util-gfm-footnote@2.0.0: + resolution: {integrity: sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==} + dependencies: + '@types/mdast': 4.0.1 + devlop: 1.1.0 + mdast-util-from-markdown: 2.0.0 + mdast-util-to-markdown: 2.1.0 + micromark-util-normalize-identifier: 2.0.0 + transitivePeerDependencies: + - supports-color + dev: false + /mdast-util-gfm-strikethrough@1.0.3: resolution: {integrity: sha512-DAPhYzTYrRcXdMjUtUjKvW9z/FNAMTdU0ORyMcbmkwYNbKocDpdk+PX1L1dQgOID/+vVs1uBQ7ElrBQfZ0cuiQ==} dependencies: @@ -3532,6 +3603,16 @@ packages: mdast-util-to-markdown: 1.5.0 dev: false + /mdast-util-gfm-strikethrough@2.0.0: + resolution: {integrity: sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==} + dependencies: + '@types/mdast': 4.0.1 + mdast-util-from-markdown: 2.0.0 + mdast-util-to-markdown: 2.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /mdast-util-gfm-table@1.0.7: resolution: {integrity: sha512-jjcpmNnQvrmN5Vx7y7lEc2iIOEytYv7rTvu+MeyAsSHTASGCCRA79Igg2uKssgOs1i1po8s3plW0sTu1wkkLGg==} dependencies: @@ -3543,6 +3624,18 @@ packages: - supports-color dev: false + /mdast-util-gfm-table@2.0.0: + resolution: {integrity: sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==} + dependencies: + '@types/mdast': 4.0.1 + devlop: 1.1.0 + markdown-table: 3.0.3 + mdast-util-from-markdown: 2.0.0 + mdast-util-to-markdown: 2.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /mdast-util-gfm-task-list-item@1.0.2: resolution: {integrity: sha512-PFTA1gzfp1B1UaiJVyhJZA1rm0+Tzn690frc/L8vNX1Jop4STZgOE6bxUhnzdVSB+vm2GU1tIsuQcA9bxTQpMQ==} dependencies: @@ -3550,6 +3643,17 @@ packages: mdast-util-to-markdown: 1.5.0 dev: false + /mdast-util-gfm-task-list-item@2.0.0: + resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==} + dependencies: + '@types/mdast': 4.0.1 + devlop: 1.1.0 + mdast-util-from-markdown: 2.0.0 + mdast-util-to-markdown: 2.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /mdast-util-gfm@2.0.2: resolution: {integrity: sha512-qvZ608nBppZ4icQlhQQIAdc6S3Ffj9RGmzwUKUWuEICFnd1LVkN3EktF7ZHAgfcEdvZB5owU9tQgt99e2TlLjg==} dependencies: @@ -3564,6 +3668,20 @@ packages: - supports-color dev: false + /mdast-util-gfm@3.0.0: + resolution: {integrity: sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==} + dependencies: + mdast-util-from-markdown: 2.0.0 + mdast-util-gfm-autolink-literal: 2.0.0 + mdast-util-gfm-footnote: 2.0.0 + mdast-util-gfm-strikethrough: 2.0.0 + mdast-util-gfm-table: 2.0.0 + mdast-util-gfm-task-list-item: 2.0.0 + mdast-util-to-markdown: 2.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /mdast-util-math@2.0.2: resolution: {integrity: sha512-8gmkKVp9v6+Tgjtq6SYx9kGPpTf6FVYRa53/DLh479aldR9AyP48qeVOgNZ5X7QUK7nOy4yw7vg6mbiGcs9jWQ==} dependencies: @@ -3634,6 +3752,13 @@ packages: unist-util-is: 5.2.1 dev: false + /mdast-util-phrasing@4.1.0: + resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==} + dependencies: + '@types/mdast': 4.0.1 + unist-util-is: 6.0.0 + dev: false + /mdast-util-to-hast@12.3.0: resolution: {integrity: sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==} dependencies: @@ -3672,6 +3797,19 @@ packages: zwitch: 2.0.4 dev: false + /mdast-util-to-markdown@2.1.0: + resolution: {integrity: sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==} + dependencies: + '@types/mdast': 4.0.1 + '@types/unist': 3.0.0 + longest-streak: 3.1.0 + mdast-util-phrasing: 4.1.0 + mdast-util-to-string: 4.0.0 + micromark-util-decode-string: 2.0.0 + unist-util-visit: 5.0.0 + zwitch: 2.0.4 + dev: false + /mdast-util-to-string@3.2.0: resolution: {integrity: sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==} dependencies: @@ -3758,7 +3896,6 @@ packages: micromark-util-subtokenize: 2.0.0 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-extension-gfm-autolink-literal@1.0.5: resolution: {integrity: sha512-z3wJSLrDf8kRDOh2qBtoTRD53vJ+CWIyo7uyZuxf/JAbNJjiHsOpG1y5wxk8drtv3ETAHutCu6N3thkOOgueWg==} @@ -3769,6 +3906,15 @@ packages: micromark-util-types: 1.1.0 dev: false + /micromark-extension-gfm-autolink-literal@2.0.0: + resolution: {integrity: sha512-rTHfnpt/Q7dEAK1Y5ii0W8bhfJlVJFnJMHIPisfPK3gpVNuOP0VnRl96+YJ3RYWV/P4gFeQoGKNlT3RhuvpqAg==} + dependencies: + micromark-util-character: 2.0.1 + micromark-util-sanitize-uri: 2.0.0 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm-footnote@1.1.2: resolution: {integrity: sha512-Yxn7z7SxgyGWRNa4wzf8AhYYWNrwl5q1Z8ii+CSTTIqVkmGZF1CElX2JI8g5yGoM3GAman9/PVCUFUSJ0kB/8Q==} dependencies: @@ -3782,6 +3928,19 @@ packages: uvu: 0.5.6 dev: false + /micromark-extension-gfm-footnote@2.0.0: + resolution: {integrity: sha512-6Rzu0CYRKDv3BfLAUnZsSlzx3ak6HAoI85KTiijuKIz5UxZxbUI+pD6oHgw+6UtQuiRwnGRhzMmPRv4smcz0fg==} + dependencies: + devlop: 1.1.0 + micromark-core-commonmark: 2.0.0 + micromark-factory-space: 2.0.0 + micromark-util-character: 2.0.1 + micromark-util-normalize-identifier: 2.0.0 + micromark-util-sanitize-uri: 2.0.0 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm-strikethrough@1.0.7: resolution: {integrity: sha512-sX0FawVE1o3abGk3vRjOH50L5TTLr3b5XMqnP9YDRb34M0v5OoZhG+OHFz1OffZ9dlwgpTBKaT4XW/AsUVnSDw==} dependencies: @@ -3793,6 +3952,17 @@ packages: uvu: 0.5.6 dev: false + /micromark-extension-gfm-strikethrough@2.0.0: + resolution: {integrity: sha512-c3BR1ClMp5fxxmwP6AoOY2fXO9U8uFMKs4ADD66ahLTNcwzSCyRVU4k7LPV5Nxo/VJiR4TdzxRQY2v3qIUceCw==} + dependencies: + devlop: 1.1.0 + micromark-util-chunked: 2.0.0 + micromark-util-classify-character: 2.0.0 + micromark-util-resolve-all: 2.0.0 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm-table@1.0.7: resolution: {integrity: sha512-3ZORTHtcSnMQEKtAOsBQ9/oHp9096pI/UvdPtN7ehKvrmZZ2+bbWhi0ln+I9drmwXMt5boocn6OlwQzNXeVeqw==} dependencies: @@ -3803,12 +3973,28 @@ packages: uvu: 0.5.6 dev: false + /micromark-extension-gfm-table@2.0.0: + resolution: {integrity: sha512-PoHlhypg1ItIucOaHmKE8fbin3vTLpDOUg8KAr8gRCF1MOZI9Nquq2i/44wFvviM4WuxJzc3demT8Y3dkfvYrw==} + dependencies: + devlop: 1.1.0 + micromark-factory-space: 2.0.0 + micromark-util-character: 2.0.1 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm-tagfilter@1.0.2: resolution: {integrity: sha512-5XWB9GbAUSHTn8VPU8/1DBXMuKYT5uOgEjJb8gN3mW0PNW5OPHpSdojoqf+iq1xo7vWzw/P8bAHY0n6ijpXF7g==} dependencies: micromark-util-types: 1.1.0 dev: false + /micromark-extension-gfm-tagfilter@2.0.0: + resolution: {integrity: sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==} + dependencies: + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm-task-list-item@1.0.5: resolution: {integrity: sha512-RMFXl2uQ0pNQy6Lun2YBYT9g9INXtWJULgbt01D/x8/6yJ2qpKyzdZD3pi6UIkzF++Da49xAelVKUeUMqd5eIQ==} dependencies: @@ -3819,6 +4005,16 @@ packages: uvu: 0.5.6 dev: false + /micromark-extension-gfm-task-list-item@2.0.1: + resolution: {integrity: sha512-cY5PzGcnULaN5O7T+cOzfMoHjBW7j+T9D2sucA5d/KbsBTPcYdebm9zUd9zzdgJGCwahV+/W78Z3nbulBYVbTw==} + dependencies: + devlop: 1.1.0 + micromark-factory-space: 2.0.0 + micromark-util-character: 2.0.1 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-gfm@2.0.3: resolution: {integrity: sha512-vb9OoHqrhCmbRidQv/2+Bc6pkP0FrtlhurxZofvOEy5o8RtuuvTq+RQ1Vw5ZDNrVraQZu3HixESqbG+0iKk/MQ==} dependencies: @@ -3832,6 +4028,19 @@ packages: micromark-util-types: 1.1.0 dev: false + /micromark-extension-gfm@3.0.0: + resolution: {integrity: sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==} + dependencies: + micromark-extension-gfm-autolink-literal: 2.0.0 + micromark-extension-gfm-footnote: 2.0.0 + micromark-extension-gfm-strikethrough: 2.0.0 + micromark-extension-gfm-table: 2.0.0 + micromark-extension-gfm-tagfilter: 2.0.0 + micromark-extension-gfm-task-list-item: 2.0.1 + micromark-util-combine-extensions: 2.0.0 + micromark-util-types: 2.0.0 + dev: false + /micromark-extension-math@2.1.2: resolution: {integrity: sha512-es0CcOV89VNS9wFmyn+wyFTKweXGW4CEvdaAca6SWRWPyYCbBisnjaHLjWO4Nszuiud84jCpkHsqAJoa768Pvg==} dependencies: @@ -3919,7 +4128,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-factory-label@1.1.0: resolution: {integrity: sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==} @@ -3937,7 +4145,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-factory-mdx-expression@1.0.9: resolution: {integrity: sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA==} @@ -3964,7 +4171,6 @@ packages: dependencies: micromark-util-character: 2.0.1 micromark-util-types: 2.0.0 - dev: true /micromark-factory-title@1.1.0: resolution: {integrity: sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==} @@ -3982,7 +4188,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-factory-whitespace@1.1.0: resolution: {integrity: sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==} @@ -4000,7 +4205,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-util-character@1.2.0: resolution: {integrity: sha512-lXraTwcX3yH/vMDaFWCQJP1uIszLVebzUa3ZHdrgxr7KEU/9mL4mVgCpGbyhvNLNlauROiNUq7WN5u7ndbY6xg==} @@ -4025,7 +4229,6 @@ packages: resolution: {integrity: sha512-anK8SWmNphkXdaKgz5hJvGa7l00qmcaUQoMYsBwDlSKFKjc6gjGXPDw3FNL3Nbwq5L8gE+RCbGqTw49FK5Qyvg==} dependencies: micromark-util-symbol: 2.0.0 - dev: true /micromark-util-classify-character@1.1.0: resolution: {integrity: sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==} @@ -4041,7 +4244,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-util-combine-extensions@1.1.0: resolution: {integrity: sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==} @@ -4055,7 +4257,6 @@ packages: dependencies: micromark-util-chunked: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-util-decode-numeric-character-reference@1.1.0: resolution: {integrity: sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==} @@ -4067,7 +4268,6 @@ packages: resolution: {integrity: sha512-pIgcsGxpHEtTG/rPJRz/HOLSqp5VTuIIjXlPI+6JSDlK2oljApusG6KzpS8AF0ENUMCHlC/IBb5B9xdFiVlm5Q==} dependencies: micromark-util-symbol: 2.0.0 - dev: true /micromark-util-decode-string@1.1.0: resolution: {integrity: sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==} @@ -4085,7 +4285,6 @@ packages: micromark-util-character: 2.0.1 micromark-util-decode-numeric-character-reference: 2.0.0 micromark-util-symbol: 2.0.0 - dev: true /micromark-util-encode@1.1.0: resolution: {integrity: sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==} @@ -4113,7 +4312,6 @@ packages: /micromark-util-html-tag-name@2.0.0: resolution: {integrity: sha512-xNn4Pqkj2puRhKdKTm8t1YHC/BAjx6CEwRFXntTaRf/x16aqka6ouVoutm+QdkISTlT7e2zU7U4ZdlDLJd2Mcw==} - dev: true /micromark-util-normalize-identifier@1.1.0: resolution: {integrity: sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==} @@ -4125,7 +4323,6 @@ packages: resolution: {integrity: sha512-2xhYT0sfo85FMrUPtHcPo2rrp1lwbDEEzpx7jiH2xXJLqBuy4H0GgXk5ToU8IEwoROtXuL8ND0ttVa4rNqYK3w==} dependencies: micromark-util-symbol: 2.0.0 - dev: true /micromark-util-resolve-all@1.1.0: resolution: {integrity: sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==} @@ -4137,7 +4334,6 @@ packages: resolution: {integrity: sha512-6KU6qO7DZ7GJkaCgwBNtplXCvGkJToU86ybBAUdavvgsCiG8lSSvYxr9MhwmQ+udpzywHsl4RpGJsYWG1pDOcA==} dependencies: micromark-util-types: 2.0.0 - dev: true /micromark-util-sanitize-uri@1.2.0: resolution: {integrity: sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==} @@ -4170,7 +4366,6 @@ packages: micromark-util-chunked: 2.0.0 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 - dev: true /micromark-util-symbol@1.1.0: resolution: {integrity: sha512-uEjpEYY6KMs1g7QfJ2eX1SQEV+ZT4rUD3UcF6l57acZvLNK7PBZL+ty82Z1qhK1/yXIY4bdx04FKMgR0g4IAag==} @@ -4232,7 +4427,6 @@ packages: micromark-util-types: 2.0.0 transitivePeerDependencies: - supports-color - dev: true /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} @@ -4861,6 +5055,22 @@ packages: unified: 10.1.2 dev: false + /rehype-raw@7.0.0: + resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==} + dependencies: + '@types/hast': 3.0.1 + hast-util-raw: 9.0.1 + vfile: 6.0.1 + dev: false + + /rehype-stringify@10.0.0: + resolution: {integrity: sha512-1TX1i048LooI9QoecrXy7nGFFbFSufxVRAfc6Y9YMRAi56l+oB0zP51mLSV312uRuvVLPV1opSlJmslozR1XHQ==} + dependencies: + '@types/hast': 3.0.1 + hast-util-to-html: 9.0.0 + unified: 11.0.4 + dev: false + /rehype-stringify@9.0.4: resolution: {integrity: sha512-Uk5xu1YKdqobe5XpSskwPvo1XeHUUucWEQSl8hTrXt5selvca1e8K1EZ37E6YoZ4BT8BCqCdVfQW7OfHfthtVQ==} dependencies: @@ -4898,6 +5108,19 @@ packages: - supports-color dev: false + /remark-gfm@4.0.0: + resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==} + dependencies: + '@types/mdast': 4.0.1 + mdast-util-gfm: 3.0.0 + micromark-extension-gfm: 3.0.0 + remark-parse: 11.0.0 + remark-stringify: 11.0.0 + unified: 11.0.4 + transitivePeerDependencies: + - supports-color + dev: false + /remark-github-beta-blockquote-admonitions@2.1.0: resolution: {integrity: sha512-mWCU9DHDWCGSGiAnAEkPVrIteeIc6uTH6sv7Jv807ndmeioqocu3PExWe7/a6ajMMKDSU4dKWpdExCA0UtJplQ==} dependencies: @@ -4932,6 +5155,17 @@ packages: - supports-color dev: false + /remark-parse@11.0.0: + resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==} + dependencies: + '@types/mdast': 4.0.1 + mdast-util-from-markdown: 2.0.0 + micromark-util-types: 2.0.0 + unified: 11.0.4 + transitivePeerDependencies: + - supports-color + dev: false + /remark-rehype@10.1.0: resolution: {integrity: sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==} dependencies: @@ -4941,6 +5175,16 @@ packages: unified: 10.1.2 dev: false + /remark-rehype@11.1.0: + resolution: {integrity: sha512-z3tJrAs2kIs1AqIIy6pzHmAHlF1hWQ+OdY4/hv+Wxe35EhyLKcajL33iUEn3ScxtFox9nUvRufR/Zre8Q08H/g==} + dependencies: + '@types/hast': 3.0.1 + '@types/mdast': 4.0.1 + mdast-util-to-hast: 13.0.2 + unified: 11.0.4 + vfile: 6.0.1 + dev: false + /remark-smartypants@2.0.0: resolution: {integrity: sha512-Rc0VDmr/yhnMQIz8n2ACYXlfw/P/XZev884QU1I5u+5DgJls32o97Vc1RbK3pfumLsJomS2yy8eT4Fxj/2MDVA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -4950,6 +5194,14 @@ packages: unist-util-visit: 4.1.2 dev: false + /remark-stringify@11.0.0: + resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} + dependencies: + '@types/mdast': 4.0.1 + mdast-util-to-markdown: 2.1.0 + unified: 11.0.4 + dev: false + /resolve@1.22.4: resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==} hasBin: true @@ -5147,6 +5399,12 @@ packages: vscode-oniguruma: 1.7.0 vscode-textmate: 8.0.0 + /shiki@1.2.4: + resolution: {integrity: sha512-Q9n9jKiOjJCRPztA9POn3/uZXNySHDNKAsPNpmtHDcFyi6ZQhx5vQKZW3Nhrwn8TWW3RudSRk66zqY603EZDeg==} + dependencies: + '@shikijs/core': 1.2.4 + dev: false + /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: false @@ -5499,6 +5757,18 @@ packages: vfile: 6.0.1 dev: true + /unified@11.0.4: + resolution: {integrity: sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ==} + dependencies: + '@types/unist': 3.0.0 + bail: 2.0.2 + devlop: 1.1.0 + extend: 3.0.2 + is-plain-obj: 4.1.0 + trough: 2.1.0 + vfile: 6.0.1 + dev: false + /unist-util-find-after@4.0.1: resolution: {integrity: sha512-QO/PuPMm2ERxC6vFXEPtmAutOopy5PknD+Oq64gGwxKtk4xwo9Z97t9Av1obPmGU0IyTa6EKYUfTrK2QJS3Ozw==} dependencies: @@ -5506,6 +5776,13 @@ packages: unist-util-is: 5.2.1 dev: false + /unist-util-find-after@5.0.0: + resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} + dependencies: + '@types/unist': 3.0.0 + unist-util-is: 6.0.0 + dev: false + /unist-util-flatmap@1.0.0: resolution: {integrity: sha512-IG32jcKJlhARCYT2LsYPJWdoXYkzz3ESAdl1aa2hn9Auh+cgUmU6wgkII4yCc/1GgeWibRdELdCZh/p3QKQ1dQ==} dev: false @@ -5556,6 +5833,13 @@ packages: unist-util-visit: 4.1.2 dev: false + /unist-util-remove-position@5.0.0: + resolution: {integrity: sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==} + dependencies: + '@types/unist': 3.0.0 + unist-util-visit: 5.0.0 + dev: false + /unist-util-stringify-position@3.0.3: resolution: {integrity: sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==} dependencies: diff --git a/src/content/posts/2024-04-04-test.md b/src/content/posts/2024-04-04-test.md new file mode 100644 index 0000000..7a6ae0e --- /dev/null +++ b/src/content/posts/2024-04-04-test.md @@ -0,0 +1,36 @@ +--- +title: test +date: 2024-04-04T21:45:28.264 +draft: true +languages: ["typst"] +tags: ["typst"] +--- + +```typst +#import "@preview/fletcher:0.4.3" as fletcher: diagram, node, edge +#set page( + width: auto, + height: auto, + margin: (x: 0.25em, y: 0.25em), +) +#set text(18pt) + +#diagram( + node-stroke: .1em, + node-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%), + spacing: 4em, + edge((-1,0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center), + node((0,0), `reading`, radius: 2em), + edge(`read()`, "-|>"), + node((1,0), `eof`, radius: 2em), + edge(`close()`, "-|>"), + node((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)), + edge((0,0), (0,0), `read()`, "--|>", bend: 130deg), + edge((0,0), (2,0), `close()`, "-|>", bend: -40deg), +) + +// #diagram(cell-size: 15mm, $ +// G edge(f, ->) edge("d", pi, ->>) & im(f) \ +// G slash ker(f) edge("ur", tilde(f), "hook-->") +// $) +```