this repo has no description
0
fork

Configure Feed

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

Add groundwork for custom rehype plugin

+117 -7
+10 -3
astro.config.mjs
··· 1 1 // @ts-check 2 2 import { defineConfig } from "astro/config"; 3 - 4 3 import mdx from "@astrojs/mdx"; 4 + import sitemap from "@astrojs/sitemap"; 5 5 6 - import sitemap from "@astrojs/sitemap"; 6 + import remarkToc from "remark-toc"; 7 + import { rehypeAccessibleEmojis } from "rehype-accessible-emojis"; 8 + import rehypeCustomHtml from "./rehype-custom-html"; 7 9 8 10 // https://astro.build/config 9 11 export default defineConfig({ 10 12 integrations: [mdx(), sitemap()], 11 13 12 14 output: "server", 15 + site: "https://vielle.dev", 13 16 14 - site: "https://vielle.dev", 17 + markdown: { 18 + // remarkPlugins: [[remarkToc, { heading: "toc", maxDepth: 3 }]], 19 + // @ts-expect-error idk why this gets flagged as wrong 20 + rehypePlugins: [rehypeAccessibleEmojis, rehypeCustomHtml], 21 + }, 15 22 });
+5 -1
package.json
··· 18 18 "astro": "5.8.2", 19 19 "lunarphase-js": "^2.0.3", 20 20 "markdown-it": "^14.1.0", 21 - "typescript": "^5.8.3" 21 + "rehype-accessible-emojis": "^0.3.2", 22 + "remark-toc": "^9.0.0", 23 + "typescript": "^5.8.3", 24 + "unified": "^11.0.5" 22 25 }, 23 26 "devDependencies": { 27 + "@types/hast": "^3.0.4", 24 28 "prettier": "3.5.3", 25 29 "prettier-plugin-astro": "0.14.1", 26 30 "pretty-quick": "^4.1.1",
+84
pnpm-lock.yaml
··· 28 28 markdown-it: 29 29 specifier: ^14.1.0 30 30 version: 14.1.0 31 + rehype-accessible-emojis: 32 + specifier: ^0.3.2 33 + version: 0.3.2 34 + remark-toc: 35 + specifier: ^9.0.0 36 + version: 9.0.0 31 37 typescript: 32 38 specifier: ^5.8.3 33 39 version: 5.8.3 40 + unified: 41 + specifier: ^11.0.5 42 + version: 11.0.5 34 43 devDependencies: 44 + "@types/hast": 45 + specifier: ^3.0.4 46 + version: 3.0.4 35 47 prettier: 36 48 specifier: 3.5.3 37 49 version: 3.5.3 ··· 930 942 integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==, 931 943 } 932 944 945 + "@types/ungap__structured-clone@1.2.0": 946 + resolution: 947 + { 948 + integrity: sha512-ZoaihZNLeZSxESbk9PUAPZOlSpcKx81I1+4emtULDVmBLkYutTcMlCj2K9VNlf9EWODxdO6gkAqEaLorXwZQVA==, 949 + } 950 + 933 951 "@types/unist@2.0.11": 934 952 resolution: 935 953 { ··· 1628 1646 engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 } 1629 1647 os: [darwin] 1630 1648 1649 + gemoji@4.2.1: 1650 + resolution: 1651 + { 1652 + integrity: sha512-V9lUpRSn+KQGavZx8Pk+6mxG3kaz21ae2kTCXuT36KaRPNgYU8eHtj/RcUCNFVvmwppsYYz3nnNS9lmcP5kTsg==, 1653 + } 1654 + 1631 1655 get-caller-file@2.0.5: 1632 1656 resolution: 1633 1657 { ··· 1671 1695 resolution: 1672 1696 { 1673 1697 integrity: sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==, 1698 + } 1699 + 1700 + hast-util-is-element@1.1.0: 1701 + resolution: 1702 + { 1703 + integrity: sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ==, 1674 1704 } 1675 1705 1676 1706 hast-util-is-element@3.0.0: ··· 2072 2102 resolution: 2073 2103 { 2074 2104 integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==, 2105 + } 2106 + 2107 + mdast-util-toc@7.1.0: 2108 + resolution: 2109 + { 2110 + integrity: sha512-2TVKotOQzqdY7THOdn2gGzS9d1Sdd66bvxUyw3aNpWfcPXCLYSJCCgfPy30sEtuzkDraJgqF35dzgmz6xlvH/w==, 2075 2111 } 2076 2112 2077 2113 mdn-data@2.12.2: ··· 2642 2678 resolution: 2643 2679 { 2644 2680 integrity: sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA==, 2681 + } 2682 + 2683 + rehype-accessible-emojis@0.3.2: 2684 + resolution: 2685 + { 2686 + integrity: sha512-kChZo+EZsuFQYHUPu6kOZFjDrG7UtQdGxkrCvHBVo9ariKPL6S68QdPVxLxwcAtZSRZIXZhDuTJHgIM8KW24Qw==, 2645 2687 } 2646 2688 2647 2689 rehype-parse@9.0.1: ··· 2711 2753 integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==, 2712 2754 } 2713 2755 2756 + remark-toc@9.0.0: 2757 + resolution: 2758 + { 2759 + integrity: sha512-KJ9txbo33GjDAV1baHFze7ij4G8c7SGYoY8Kzsm2gzFpbhL/bSoVpMMzGa3vrNDSWASNd/3ppAqL7cP2zD6JIA==, 2760 + } 2761 + 2714 2762 request-light@0.5.8: 2715 2763 resolution: 2716 2764 { ··· 3095 3143 integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==, 3096 3144 } 3097 3145 3146 + unist-util-flatmap@1.0.0: 3147 + resolution: 3148 + { 3149 + integrity: sha512-IG32jcKJlhARCYT2LsYPJWdoXYkzz3ESAdl1aa2hn9Auh+cgUmU6wgkII4yCc/1GgeWibRdELdCZh/p3QKQ1dQ==, 3150 + } 3151 + 3098 3152 unist-util-is@6.0.0: 3099 3153 resolution: 3100 3154 { ··· 4112 4166 dependencies: 4113 4167 "@types/node": 22.15.20 4114 4168 4169 + "@types/ungap__structured-clone@1.2.0": {} 4170 + 4115 4171 "@types/unist@2.0.11": {} 4116 4172 4117 4173 "@types/unist@3.0.3": {} ··· 4606 4662 fsevents@2.3.3: 4607 4663 optional: true 4608 4664 4665 + gemoji@4.2.1: {} 4666 + 4609 4667 get-caller-file@2.0.5: {} 4610 4668 4611 4669 get-east-asian-width@1.3.0: {} ··· 4647 4705 vfile: 6.0.3 4648 4706 vfile-location: 5.0.3 4649 4707 web-namespaces: 2.0.1 4708 + 4709 + hast-util-is-element@1.1.0: {} 4650 4710 4651 4711 hast-util-is-element@3.0.0: 4652 4712 dependencies: ··· 5028 5088 dependencies: 5029 5089 "@types/mdast": 4.0.4 5030 5090 5091 + mdast-util-toc@7.1.0: 5092 + dependencies: 5093 + "@types/mdast": 4.0.4 5094 + "@types/ungap__structured-clone": 1.2.0 5095 + "@ungap/structured-clone": 1.3.0 5096 + github-slugger: 2.0.0 5097 + mdast-util-to-string: 4.0.0 5098 + unist-util-is: 6.0.0 5099 + unist-util-visit: 5.0.0 5100 + 5031 5101 mdn-data@2.12.2: {} 5032 5102 5033 5103 mdurl@2.0.0: {} ··· 5488 5558 dependencies: 5489 5559 regex-utilities: 2.3.0 5490 5560 5561 + rehype-accessible-emojis@0.3.2: 5562 + dependencies: 5563 + emoji-regex: 8.0.0 5564 + gemoji: 4.2.1 5565 + hast-util-is-element: 1.1.0 5566 + unist-util-flatmap: 1.0.0 5567 + 5491 5568 rehype-parse@9.0.1: 5492 5569 dependencies: 5493 5570 "@types/hast": 3.0.4 ··· 5568 5645 "@types/mdast": 4.0.4 5569 5646 mdast-util-to-markdown: 2.1.2 5570 5647 unified: 11.0.5 5648 + 5649 + remark-toc@9.0.0: 5650 + dependencies: 5651 + "@types/mdast": 4.0.4 5652 + mdast-util-toc: 7.1.0 5571 5653 5572 5654 request-light@0.5.8: {} 5573 5655 ··· 5823 5905 dependencies: 5824 5906 "@types/unist": 3.0.3 5825 5907 unist-util-is: 6.0.0 5908 + 5909 + unist-util-flatmap@1.0.0: {} 5826 5910 5827 5911 unist-util-is@6.0.0: 5828 5912 dependencies:
+3 -3
posts/full-test.md
··· 66 66 1. an unordered list 67 67 2. which has 68 68 69 - 1) nesting 70 - 2) high numbers 69 + 1. nesting 70 + 2. high numbers 71 71 72 - 999999999. biiig 72 + 3. biiig 💥💥💥 <!-- should be big? itshould --> 73 73 74 74 ### Check 75 75
+15
rehype-custom-html.ts
··· 1 + import type { Plugin } from "unified"; 2 + import type { Root } from "hast"; 3 + type Options = {}; 4 + 5 + const plugin: Plugin<[Options], Root> = function (options) { 6 + return function (node, file) { 7 + if (file.basename !== "full-test.md") return; 8 + console.log(node); 9 + for (const n of node.children) { 10 + console.log(n.type == "element" ? n.tagName : n.type); 11 + } 12 + }; 13 + }; 14 + 15 + export default plugin;