Skip to content

Commit

Permalink
Add rehype-citation
Browse files Browse the repository at this point in the history
  • Loading branch information
bluprince13 committed Jun 15, 2024
1 parent 1cb54a1 commit 2f2bf37
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"react-share": "5.1.0",
"react-social-icons": "6.16.0",
"rehype-autolink-headings": "7.1.0",
"rehype-citation": "^2.0.0",
"rehype-slug": "6.0.0",
"remark-codesandbox": "^0.10.1",
"remark-emoji": "4.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/modules/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type PostData = {
title: string
description: string
bannerFullUrl: string
bibliography?: string
}

export type PostContent = string
Expand Down
7 changes: 7 additions & 0 deletions src/pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import prism from 'remark-prism'
import slug from 'rehype-slug'
import link from 'rehype-autolink-headings'
import mdxMermaid from 'mdx-mermaid'
import rehypeCitation from 'rehype-citation'

import {
getAllPostSlugs,
Expand Down Expand Up @@ -100,6 +101,12 @@ export const getStaticProps: GetStaticProps<{
],
rehypePlugins: [
slug,
[
rehypeCitation,
{
bibliography: data.bibliography
}
],
[
link,
{
Expand Down
159 changes: 156 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,51 @@
resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783"
integrity sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A==

"@citation-js/core@^0.7.1":
version "0.7.13"
resolved "https://registry.yarnpkg.com/@citation-js/core/-/core-0.7.13.tgz#63f7952f09c1d238aa0d73af71f388a460d6f2ef"
integrity sha512-lgas8mA+pVU0L5uYz8YGSZa8gnhnPyW27KltcDjMsj7b5MFgsIs6FpDOkQIh4nE/COhE/CQVuY1oL0dtu6j39g==
dependencies:
"@citation-js/date" "^0.5.0"
"@citation-js/name" "^0.4.2"
fetch-ponyfill "^7.1.0"
sync-fetch "^0.4.1"

"@citation-js/date@^0.5.0", "@citation-js/date@^0.5.1":
version "0.5.1"
resolved "https://registry.yarnpkg.com/@citation-js/date/-/date-0.5.1.tgz#5d4e3746ce6a66b467c94071284de1c38e9a4987"
integrity sha512-1iDKAZ4ie48PVhovsOXQ+C6o55dWJloXqtznnnKy6CltJBQLIuLLuUqa8zlIvma0ZigjVjgDUhnVaNU1MErtZw==

"@citation-js/name@^0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@citation-js/name/-/name-0.4.2.tgz#8dc834b7e6c06998fc8d3b63632658754c94a875"
integrity sha512-brSPsjs2fOVzSnARLKu0qncn6suWjHVQtrqSUrnqyaRH95r/Ad4wPF5EsoWr+Dx8HzkCGb/ogmoAzfCsqlTwTQ==

"@citation-js/plugin-bibjson@^0.7.2":
version "0.7.13"
resolved "https://registry.yarnpkg.com/@citation-js/plugin-bibjson/-/plugin-bibjson-0.7.13.tgz#319f856f992a6886dafc65694816fa2ba719eac2"
integrity sha512-tXhDAm8CdNvtA5gWYPJxqg+IKiEv+qor1fX4AMd4utO2pXzx1vjPzfKRuZTM6uRh+Epe4bbHp1UNFSPghqogtQ==
dependencies:
"@citation-js/date" "^0.5.0"
"@citation-js/name" "^0.4.2"

"@citation-js/plugin-bibtex@^0.7.2":
version "0.7.13"
resolved "https://registry.yarnpkg.com/@citation-js/plugin-bibtex/-/plugin-bibtex-0.7.13.tgz#1702638886c844db31ba72acecbfe3bd5eec7898"
integrity sha512-cGzDfpiPXqlAtlinswoGLJhCmJEs5hOme6XaUlJqhdHJ8V7cTwS2/IBa27b8dwVLF0m1FyPWkCL04fd+AvKxqg==
dependencies:
"@citation-js/date" "^0.5.0"
"@citation-js/name" "^0.4.2"
moo "^0.5.1"

"@citation-js/plugin-csl@^0.7.2":
version "0.7.13"
resolved "https://registry.yarnpkg.com/@citation-js/plugin-csl/-/plugin-csl-0.7.13.tgz#712c569c9ccf1c005b428f53ad6ec7b15864fb7c"
integrity sha512-u8H/eR1PCBbtDQhD9W97siXSGbtyCQLjeeKghlT6+ZzprShg/684+HoeLScxUlBTBp0y8Cu1ZtUwneY8UVnnkw==
dependencies:
"@citation-js/date" "^0.5.0"
citeproc "^2.4.6"

"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"
Expand Down Expand Up @@ -2454,7 +2499,7 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==

buffer@^5.2.1, buffer@^5.5.0:
buffer@^5.2.1, buffer@^5.5.0, buffer@^5.7.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
Expand Down Expand Up @@ -2648,6 +2693,11 @@ ci-info@^3.2.0:
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4"
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==

citeproc@^2.4.6, citeproc@^2.4.63:
version "2.4.63"
resolved "https://registry.yarnpkg.com/citeproc/-/citeproc-2.4.63.tgz#de6d30646e264f96b39cedb526f231abe1a5a718"
integrity sha512-68F95Bp4UbgZU/DBUGQn0qV3HDZLCdI9+Bb2ByrTaNJDL5VEm9LqaiNaxljsvoaExSLEXe1/r6n2Z06SCzW3/Q==

cjs-module-lexer@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c"
Expand Down Expand Up @@ -2951,6 +3001,13 @@ [email protected]:
dependencies:
node-fetch "2.6.7"

cross-fetch@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983"
integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==
dependencies:
node-fetch "^2.6.12"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand Down Expand Up @@ -4431,6 +4488,13 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4:
node-domexception "^1.0.0"
web-streams-polyfill "^3.0.3"

fetch-ponyfill@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/fetch-ponyfill/-/fetch-ponyfill-7.1.0.tgz#4266ed48b4e64663a50ab7f7fcb8e76f990526d0"
integrity sha512-FhbbL55dj/qdVO3YNK7ZEkshvj3eQ7EuIGV2I6ic/2YiocvyWv+7jg2s4AyS0wdRU75s3tA8ZxI/xPigb0v5Aw==
dependencies:
node-fetch "~2.6.1"

figures@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
Expand Down Expand Up @@ -5041,6 +5105,15 @@ hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2:
dependencies:
function-bind "^1.1.2"

hast-util-from-dom@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/hast-util-from-dom/-/hast-util-from-dom-5.0.0.tgz#d32edd25bf28f4b178b5ae318f8d05762e67bd16"
integrity sha512-d6235voAp/XR3Hh5uy7aGLbM3S4KamdW0WEgOaU1YoewnuYw4HXb5eRtv9g65m/RFGEfUY1Mw4UqCc5Y8L4Stg==
dependencies:
"@types/hast" "^3.0.0"
hastscript "^8.0.0"
web-namespaces "^2.0.0"

hast-util-from-html@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/hast-util-from-html/-/hast-util-from-html-1.0.2.tgz#2482fd701b2d8270b912b3909d6fb645d4a346cf"
Expand All @@ -5065,6 +5138,20 @@ hast-util-from-parse5@^7.0.0:
vfile-location "^4.0.0"
web-namespaces "^2.0.0"

hast-util-from-parse5@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-8.0.1.tgz#654a5676a41211e14ee80d1b1758c399a0327651"
integrity sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==
dependencies:
"@types/hast" "^3.0.0"
"@types/unist" "^3.0.0"
devlop "^1.0.0"
hastscript "^8.0.0"
property-information "^6.0.0"
vfile "^6.0.0"
vfile-location "^5.0.0"
web-namespaces "^2.0.0"

hast-util-heading-rank@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/hast-util-heading-rank/-/hast-util-heading-rank-3.0.0.tgz#2d5c6f2807a7af5c45f74e623498dd6054d2aba8"
Expand All @@ -5086,6 +5173,13 @@ hast-util-parse-selector@^3.0.0:
dependencies:
"@types/hast" "^2.0.0"

hast-util-parse-selector@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz#352879fa86e25616036037dd8931fb5f34cb4a27"
integrity sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==
dependencies:
"@types/hast" "^3.0.0"

hast-util-to-estree@^2.1.0:
version "2.3.3"
resolved "https://registry.yarnpkg.com/hast-util-to-estree/-/hast-util-to-estree-2.3.3.tgz#da60142ffe19a6296923ec222aba73339c8bf470"
Expand Down Expand Up @@ -5180,6 +5274,17 @@ hastscript@^7.0.0:
property-information "^6.0.0"
space-separated-tokens "^2.0.0"

hastscript@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-8.0.0.tgz#4ef795ec8dee867101b9f23cc830d4baf4fd781a"
integrity sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==
dependencies:
"@types/hast" "^3.0.0"
comma-separated-tokens "^2.0.0"
hast-util-parse-selector "^4.0.0"
property-information "^6.0.0"
space-separated-tokens "^2.0.0"

hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
Expand Down Expand Up @@ -7843,6 +7948,11 @@ mkdirp@^0.5.1:
dependencies:
minimist "^1.2.6"

moo@^0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.2.tgz#f9fe82473bc7c184b0d32e2215d3f6e67278733c"
integrity sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==

move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
Expand Down Expand Up @@ -8011,7 +8121,7 @@ node-fetch@^1.0.1:
encoding "^0.1.11"
is-stream "^1.0.1"

node-fetch@^2.6.1, node-fetch@^2.6.9:
node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.9:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
Expand All @@ -8027,6 +8137,13 @@ node-fetch@^3.2.0:
fetch-blob "^3.1.4"
formdata-polyfill "^4.0.10"

node-fetch@~2.6.1:
version "2.6.13"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.13.tgz#a20acbbec73c2e09f9007de5cda17104122e0010"
integrity sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==
dependencies:
whatwg-url "^5.0.0"

node-forge@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
Expand Down Expand Up @@ -8404,7 +8521,7 @@ [email protected], parse5@^6.0.1:
resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b"
integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==

parse5@^7.0.0, parse5@^7.1.1:
parse5@^7.0.0, parse5@^7.1.1, parse5@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32"
integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==
Expand Down Expand Up @@ -8990,6 +9107,26 @@ [email protected]:
unified "^11.0.0"
unist-util-visit "^5.0.0"

rehype-citation@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/rehype-citation/-/rehype-citation-2.0.0.tgz#057e58212dbc98c0c8232f2a739e4bfb3ed355e6"
integrity sha512-rGawTBI8SJA1Y4IRyROvpYF6oXBVNFXlJYHIJ2jJH3HgeuCbAC9AO8wE/NMPLDOPQ8+Q8QkZm93fKsnUNbvwZA==
dependencies:
"@citation-js/core" "^0.7.1"
"@citation-js/date" "^0.5.1"
"@citation-js/name" "^0.4.2"
"@citation-js/plugin-bibjson" "^0.7.2"
"@citation-js/plugin-bibtex" "^0.7.2"
"@citation-js/plugin-csl" "^0.7.2"
citeproc "^2.4.63"
cross-fetch "^4.0.0"
hast-util-from-dom "^5.0.0"
hast-util-from-parse5 "^8.0.1"
js-yaml "^4.1.0"
parse5 "^7.1.2"
unified "^11.0.0"
unist-util-visit "^5.0.0"

[email protected]:
version "6.0.0"
resolved "https://registry.yarnpkg.com/rehype-slug/-/rehype-slug-6.0.0.tgz#1d21cf7fc8a83ef874d873c15e6adaee6344eaf1"
Expand Down Expand Up @@ -9866,6 +10003,14 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==

sync-fetch@^0.4.1:
version "0.4.5"
resolved "https://registry.yarnpkg.com/sync-fetch/-/sync-fetch-0.4.5.tgz#33ccf627ca72944ccdd3ebff581bb506be70f6a0"
integrity sha512-esiWJ7ixSKGpd9DJPBTC4ckChqdOjIwJfYhVHkcQ2Gnm41323p1TRmEI+esTQ9ppD+b5opps2OTEGTCGX5kF+g==
dependencies:
buffer "^5.7.1"
node-fetch "^2.6.1"

tapable@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
Expand Down Expand Up @@ -10575,6 +10720,14 @@ vfile-location@^4.0.0:
"@types/unist" "^2.0.0"
vfile "^5.0.0"

vfile-location@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-5.0.2.tgz#220d9ca1ab6f8b2504a4db398f7ebc149f9cb464"
integrity sha512-NXPYyxyBSH7zB5U6+3uDdd6Nybz6o6/od9rk8bp9H8GR3L+cm/fC0uUTbqBmUTnMCUDslAGBOIKNfvvb+gGlDg==
dependencies:
"@types/unist" "^3.0.0"
vfile "^6.0.0"

vfile-matter@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vfile-matter/-/vfile-matter-5.0.0.tgz#4f8d6476a432f9556784a8b538f7da0ba25e053d"
Expand Down

1 comment on commit 2f2bf37

@vercel
Copy link

@vercel vercel bot commented on 2f2bf37 Jun 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.