Oskar Manhart
2023-09-11 4e23e6724493a8d112c6ff22e14cf4aabd5e9af1
feat: plugin for remark-breaks (#467)

* feat: plugin for remark-breaks

* fix: update package-lock.json

* fix: styling

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>

* Update linebreaks.ts

* Update index.ts

---------

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>
1 files added
3 files modified
41 ■■■■■ changed files
package-lock.json 28 ●●●●● patch | view | raw | blame | history
package.json 1 ●●●● patch | view | raw | blame | history
quartz/plugins/transformers/index.ts 1 ●●●● patch | view | raw | blame | history
quartz/plugins/transformers/linebreaks.ts 11 ●●●●● patch | view | raw | blame | history
package-lock.json
@@ -45,6 +45,7 @@
        "rehype-raw": "^6.1.1",
        "rehype-slug": "^5.1.0",
        "remark": "^14.0.2",
        "remark-breaks": "^3.0.3",
        "remark-frontmatter": "^4.0.1",
        "remark-gfm": "^3.0.1",
        "remark-math": "^5.1.1",
@@ -3810,6 +3811,19 @@
        "url": "https://opencollective.com/unified"
      }
    },
    "node_modules/mdast-util-newline-to-break": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/mdast-util-newline-to-break/-/mdast-util-newline-to-break-1.0.0.tgz",
      "integrity": "sha512-491LcYv3gbGhhCrLoeALncQmega2xPh+m3gbsIhVsOX4sw85+ShLFPvPyibxc1Swx/6GtzxgVodq+cGa/47ULg==",
      "dependencies": {
        "@types/mdast": "^3.0.0",
        "mdast-util-find-and-replace": "^2.0.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/unified"
      }
    },
    "node_modules/mdast-util-phrasing": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz",
@@ -4903,6 +4917,20 @@
        "url": "https://opencollective.com/unified"
      }
    },
    "node_modules/remark-breaks": {
      "version": "3.0.3",
      "resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-3.0.3.tgz",
      "integrity": "sha512-C7VkvcUp1TPUc2eAYzsPdaUh8Xj4FSbQnYA5A9f80diApLZscTDeG7efiWP65W8hV2sEy3JuGVU0i6qr5D8Hug==",
      "dependencies": {
        "@types/mdast": "^3.0.0",
        "mdast-util-newline-to-break": "^1.0.0",
        "unified": "^10.0.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/unified"
      }
    },
    "node_modules/remark-frontmatter": {
      "version": "4.0.1",
      "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-4.0.1.tgz",
package.json
@@ -69,6 +69,7 @@
    "rehype-raw": "^6.1.1",
    "rehype-slug": "^5.1.0",
    "remark": "^14.0.2",
    "remark-breaks": "^3.0.3",
    "remark-frontmatter": "^4.0.1",
    "remark-gfm": "^3.0.1",
    "remark-math": "^5.1.1",
quartz/plugins/transformers/index.ts
@@ -8,3 +8,4 @@
export { OxHugoFlavouredMarkdown } from "./oxhugofm"
export { SyntaxHighlighting } from "./syntax"
export { TableOfContents } from "./toc"
export { HardLineBreaks } from "./linebreaks"
quartz/plugins/transformers/linebreaks.ts
New file
@@ -0,0 +1,11 @@
import { QuartzTransformerPlugin } from "../types"
import remarkBreaks from "remark-breaks"
export const HardLineBreaks: QuartzTransformerPlugin = () => {
  return {
    name: "HardLineBreaks",
    markdownPlugins() {
      return [remarkBreaks]
    },
  }
}