Jacky Zhao
2023-11-14 74777118a7fd19e4a296706c2a4b5fdca546c4fa
quartz/plugins/transformers/ofm.ts
@@ -1,7 +1,7 @@
import { PluggableList } from "unified"
import { QuartzTransformerPlugin } from "../types"
import { Root, HTML, BlockContent, DefinitionContent, Code, Paragraph } from "mdast"
import { Element, Literal } from "hast"
import { Element, Literal, Root as HtmlRoot } from "hast"
import { Replace, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace"
import { slug as slugAnchor } from "github-slugger"
import rehypeRaw from "rehype-raw"
@@ -236,13 +236,13 @@
                    value: `<iframe src="${url}"></iframe>`,
                  }
                } else if (ext === "") {
                  const block = anchor.slice(1)
                  const block = anchor
                  return {
                    type: "html",
                    data: { hProperties: { transclude: true } },
                    value: `<blockquote class="transclude" data-url="${url}" data-block="${block}"><a href="${
                      url + anchor
                    }" class="transclude-inner">Transclude of block ${block}</a></blockquote>`,
                    }" class="transclude-inner">Transclude of ${url}${block}</a></blockquote>`,
                  }
                }
@@ -436,6 +436,7 @@
          const blockTagTypes = new Set(["blockquote"])
          return (tree, file) => {
            file.data.blocks = {}
            file.data.htmlAst = tree
            visit(tree, "element", (node, index, parent) => {
              if (blockTagTypes.has(node.tagName)) {
@@ -524,5 +525,6 @@
declare module "vfile" {
  interface DataMap {
    blocks: Record<string, Element>
    htmlAst: HtmlRoot
  }
}