The Trans Directory
0
fork

Configure Feed

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

fix: mermaid rendering fix from upstream

+22 -26
+4 -4
package-lock.json
··· 41 41 "rehype-autolink-headings": "^7.1.0", 42 42 "rehype-katex": "^7.0.0", 43 43 "rehype-mathjax": "^5.0.0", 44 - "rehype-pretty-code": "^0.12.2", 44 + "rehype-pretty-code": "^0.12.3", 45 45 "rehype-raw": "^7.0.0", 46 46 "rehype-slug": "^6.0.0", 47 47 "remark": "^15.0.1", ··· 4713 4713 } 4714 4714 }, 4715 4715 "node_modules/rehype-pretty-code": { 4716 - "version": "0.12.2", 4717 - "resolved": "https://registry.npmjs.org/rehype-pretty-code/-/rehype-pretty-code-0.12.2.tgz", 4718 - "integrity": "sha512-PiGNCFrCkt54G/3ez6RLfU38jWUmgDe60Y81PAxj69A7+EAbhp8UhEigVOwK9ZEJDyedPr0ORWhcqfOn4RNedg==", 4716 + "version": "0.12.3", 4717 + "resolved": "https://registry.npmjs.org/rehype-pretty-code/-/rehype-pretty-code-0.12.3.tgz", 4718 + "integrity": "sha512-6NbIit8A3hLrkKBEbNs862jVnTLeIOM2AmM0VZ/MtyHb+OuNMeCa6UZSx6UG4zrobm5tY9efTwhih1exsGYsiw==", 4719 4719 "dependencies": { 4720 4720 "@types/hast": "^3.0.3", 4721 4721 "hast-util-to-string": "^3.0.0",
+1 -1
package.json
··· 66 66 "rehype-autolink-headings": "^7.1.0", 67 67 "rehype-katex": "^7.0.0", 68 68 "rehype-mathjax": "^5.0.0", 69 - "rehype-pretty-code": "^0.12.2", 69 + "rehype-pretty-code": "^0.12.3", 70 70 "rehype-raw": "^7.0.0", 71 71 "rehype-slug": "^6.0.0", 72 72 "remark": "^15.0.1",
+1 -1
quartz.config.ts
··· 49 49 Plugin.CreatedModifiedDate({ 50 50 priority: ["frontmatter", "filesystem"], // you can add 'git' here for last modified from Git but this makes the build slower 51 51 }), 52 - Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), 53 52 Plugin.SyntaxHighlighting(), 53 + Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), 54 54 Plugin.GitHubFlavoredMarkdown(), 55 55 Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), 56 56 Plugin.Latex({ renderEngine: "katex" }),
+13 -18
quartz/plugins/transformers/ofm.ts
··· 1 1 import { QuartzTransformerPlugin } from "../types" 2 - import { Root, Html, BlockContent, DefinitionContent, Paragraph } from "mdast" 2 + import { Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast" 3 3 import { Element, Literal, Root as HtmlRoot } from "hast" 4 4 import { ReplaceFunction, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace" 5 5 import { slug as slugAnchor } from "github-slugger" ··· 423 423 }) 424 424 } 425 425 426 - return plugins 427 - }, 428 - htmlPlugins() { 429 - const plugins: PluggableList = [rehypeRaw] 430 - 431 426 if (opts.mermaid) { 432 427 plugins.push(() => { 433 - return (tree: HtmlRoot, _file) => { 434 - visit(tree, "element", (node) => { 435 - if (node.tagName === "pre") { 436 - const firstChild = node.children[0] 437 - if (firstChild && firstChild.type === "element" && firstChild.tagName === "code") { 438 - const code = firstChild 439 - const isMermaidBlock = 440 - (code.properties["className"] as Array<string>)?.[0] === "language-mermaid" 441 - if (isMermaidBlock) { 442 - node.children = code.children 443 - node.properties.className = ["mermaid"] 444 - } 428 + return (tree: Root, _file) => { 429 + visit(tree, "code", (node: Code) => { 430 + if (node.lang === "mermaid") { 431 + node.data = { 432 + hProperties: { 433 + className: ["mermaid"], 434 + }, 445 435 } 446 436 } 447 437 }) 448 438 } 449 439 }) 450 440 } 441 + 442 + return plugins 443 + }, 444 + htmlPlugins() { 445 + const plugins: PluggableList = [rehypeRaw] 451 446 452 447 if (opts.parseBlockReferences) { 453 448 plugins.push(() => {
+3 -2
quartz/styles/base.scss
··· 328 328 329 329 pre { 330 330 font-family: var(--codeFont); 331 - padding: 0.5rem; 331 + padding: 0 0.5rem; 332 332 border-radius: 5px; 333 333 overflow-x: auto; 334 334 border: 1px solid var(--lightgray); 335 + position: relative; 335 336 336 - &.mermaid { 337 + &:has(> code.mermaid) { 337 338 border: none; 338 339 } 339 340