extract type from markdown: pesto

This commit is contained in:
Johannes Kirschbauer 2023-12-26 14:24:07 +01:00 committed by Johannes Kirschbauer
parent a7614cba7c
commit b886e7f40b
25 changed files with 40603 additions and 112 deletions

509
pesto/Cargo.lock generated
View File

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.1.2"
@ -61,7 +67,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -71,7 +77,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
dependencies = [
"anstyle",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -86,6 +92,42 @@ version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"serde",
]
[[package]]
name = "bit-set"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
dependencies = [
"bit-vec",
]
[[package]]
name = "bit-vec"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "bumpalo"
version = "3.14.0"
@ -117,7 +159,7 @@ dependencies = [
"iana-time-zone",
"num-traits",
"serde",
"windows-targets",
"windows-targets 0.48.5",
]
[[package]]
@ -140,6 +182,7 @@ dependencies = [
"anstyle",
"clap_lex",
"strsim",
"terminal_size",
]
[[package]]
@ -151,7 +194,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
@ -166,6 +209,26 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "comrak"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f18e72341e6cdc7489cffb76f993812a14a906db54dedb020044ccc211dcaae"
dependencies = [
"clap",
"derive_builder",
"entities",
"memchr",
"once_cell",
"regex",
"shell-words",
"slug",
"syntect",
"typed-arena",
"unicode_categories",
"xdg",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
@ -178,14 +241,47 @@ version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if",
]
[[package]]
name = "darling"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [
"darling_core 0.14.4",
"darling_macro 0.14.4",
]
[[package]]
name = "darling"
version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e"
dependencies = [
"darling_core",
"darling_macro",
"darling_core 0.20.3",
"darling_macro 0.20.3",
]
[[package]]
name = "darling_core"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 1.0.109",
]
[[package]]
@ -199,7 +295,18 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn",
"syn 2.0.39",
]
[[package]]
name = "darling_macro"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core 0.14.4",
"quote",
"syn 1.0.109",
]
[[package]]
@ -208,9 +315,9 @@ version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [
"darling_core",
"darling_core 0.20.3",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
@ -223,18 +330,71 @@ dependencies = [
"serde",
]
[[package]]
name = "derive_builder"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
dependencies = [
"derive_builder_macro",
]
[[package]]
name = "derive_builder_core"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
dependencies = [
"darling 0.14.4",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "derive_builder_macro"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
dependencies = [
"derive_builder_core",
"syn 1.0.109",
]
[[package]]
name = "deunicode"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae2a35373c5c74340b79ae6780b498b2b183915ec5dacf263aac5a099bf485a"
[[package]]
name = "dissimilar"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632"
[[package]]
name = "entities"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "expect-test"
version = "1.4.1"
@ -245,6 +405,26 @@ dependencies = [
"once_cell",
]
[[package]]
name = "fancy-regex"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
dependencies = [
"bit-set",
"regex",
]
[[package]]
name = "flate2"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -347,6 +527,27 @@ version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "line-wrap"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
dependencies = [
"safemem",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
[[package]]
name = "log"
version = "0.4.20"
@ -368,6 +569,15 @@ dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
dependencies = [
"adler",
]
[[package]]
name = "num-traits"
version = "0.2.17"
@ -383,11 +593,34 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "onig"
version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f"
dependencies = [
"bitflags 1.3.2",
"libc",
"once_cell",
"onig_sys",
]
[[package]]
name = "onig_sys"
version = "69.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7"
dependencies = [
"cc",
"pkg-config",
]
[[package]]
name = "pesto"
version = "0.1.0"
dependencies = [
"clap",
"comrak",
"expect-test",
"regex",
"rnix",
@ -400,6 +633,26 @@ dependencies = [
"walkdir",
]
[[package]]
name = "pkg-config"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
[[package]]
name = "plist"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef"
dependencies = [
"base64",
"indexmap 2.1.0",
"line-wrap",
"quick-xml",
"serde",
"time",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
@ -415,6 +668,15 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-xml"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.33"
@ -433,7 +695,7 @@ dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
"regex-syntax 0.8.2",
]
[[package]]
@ -444,9 +706,15 @@ checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"regex-syntax 0.8.2",
]
[[package]]
name = "regex-syntax"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "regex-syntax"
version = "0.8.2"
@ -481,12 +749,31 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "safemem"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
[[package]]
name = "same-file"
version = "1.0.6"
@ -513,7 +800,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
@ -550,10 +837,10 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788"
dependencies = [
"darling",
"darling 0.20.3",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
@ -569,6 +856,22 @@ dependencies = [
"unsafe-libyaml",
]
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "slug"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4"
dependencies = [
"deunicode",
"wasm-bindgen",
]
[[package]]
name = "smawk"
version = "0.3.2"
@ -581,6 +884,17 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.39"
@ -592,6 +906,38 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syntect"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91"
dependencies = [
"bincode",
"bitflags 1.3.2",
"fancy-regex",
"flate2",
"fnv",
"once_cell",
"onig",
"plist",
"regex-syntax 0.7.5",
"serde",
"serde_json",
"thiserror",
"walkdir",
"yaml-rust",
]
[[package]]
name = "terminal_size"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
dependencies = [
"rustix",
"windows-sys 0.48.0",
]
[[package]]
name = "text-size"
version = "1.1.1"
@ -609,6 +955,26 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
]
[[package]]
name = "time"
version = "0.3.30"
@ -638,6 +1004,12 @@ dependencies = [
"time-core",
]
[[package]]
name = "typed-arena"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "unicode-ident"
version = "1.0.12"
@ -656,6 +1028,12 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unicode_categories"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
[[package]]
name = "unsafe-libyaml"
version = "0.2.9"
@ -699,7 +1077,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
"wasm-bindgen-shared",
]
@ -721,7 +1099,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -769,7 +1147,7 @@ version = "0.51.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
dependencies = [
"windows-targets",
"windows-targets 0.48.5",
]
[[package]]
@ -778,7 +1156,16 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
@ -787,13 +1174,28 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
]
[[package]]
@ -802,38 +1204,95 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "xdg"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]

View File

@ -22,6 +22,7 @@ serde_json = "1.0"
expect-test = "1.4.0"
serde_with = "3.4.0"
serde_yaml = "0.9.27"
comrak = "0.20.0"
# [dev-dependencies]

1
pesto/json.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,13 @@
mod alias;
mod bulk;
mod comment;
mod markdown;
mod pasta;
mod position;
mod tests;
use clap::{Parser, ValueEnum};
use markdown::find_type;
use pasta::{AliasList, ContentSource, Docs, Lookups, PositionType, SourceOrigin, ValuePath};
use position::FilePosition;
use serde::Serialize;
@ -85,6 +87,12 @@ pub fn main() {
let document = Document::new(&item, &data.doc_map);
let matter = &document.meta;
let content = &document.content;
let signature = content
.as_ref()
.map(|c| c.content.as_ref().map(|s| find_type(&s)))
.flatten();
match opts.format {
Format::DIR => {
if let Some((_, dir)) = item.path.split_last() {
@ -159,6 +167,7 @@ struct DocumentFrontmatter<'a> {
title: String,
path: &'a Rc<ValuePath>,
aliases: Option<&'a AliasList>,
signature: Option<String>,
/// If an item is primop then it should have the PrimopMeta field.
is_primop: Option<bool>,
primop_meta: Option<PrimopMatter<'a>>,
@ -181,6 +190,11 @@ impl<'a> FromDocs<'a> for Document<'a> {
let content = find_document_content(item, &data);
Self {
meta: DocumentFrontmatter {
signature: content
.as_ref()
.map(|c| c.content.as_ref().map(|s| find_type(s)))
.flatten()
.flatten(),
content_meta: content.as_ref().map(|inner| inner.source.clone()).flatten(),
title: item.path.join(".").replace("'", "' (Prime)"),
path: &item.path,

50
pesto/src/markdown.rs Normal file
View File

@ -0,0 +1,50 @@
use comrak::nodes::{AstNode, NodeValue};
use comrak::{parse_document, Arena, Options};
fn iter_nodes<'a, F>(node: &'a AstNode<'a>, f: &mut F)
where
F: FnMut(&'a AstNode<'a>),
{
f(node);
for c in node.children() {
iter_nodes(c, f);
}
}
/// Find the type signature
///
/// Looks for any heading "# Type" (case insensitive)
///
/// The first code or code_block in that section is the type signature
pub fn find_type(content: &str) -> Option<String> {
// The returned nodes are created in the supplied Arena, and are bound by its lifetime.
let arena = Arena::new();
let root = parse_document(&arena, content, &Options::default());
let mut signature: Option<String> = None;
let mut do_capture = false;
iter_nodes(root, &mut |node| match &node.data.borrow().value {
NodeValue::Heading(_) => {
match node
.first_child()
.as_ref()
.map(|n| n.data.borrow().value.clone())
{
Some(NodeValue::Text(text)) if text.trim().to_lowercase() == "type" => {
do_capture = true;
}
_ => {
do_capture = false;
}
}
}
NodeValue::CodeBlock(code_block) => {
if signature.is_none() && do_capture {
signature = Some(code_block.literal.clone());
}
}
_ => (),
});
signature
}

View File

@ -5,6 +5,7 @@ mod tests {
use crate::{
bulk::BulkProcessing,
markdown::find_type,
pasta::{AliasList, Pasta, ValuePath},
position::{DocComment, DocIndex, TextPosition},
Document, FromDocs,
@ -150,6 +151,15 @@ mod tests {
})
}
#[test]
fn test_type_from_markdown() {
dir_tests("types", "md", |path| {
let markdown = fs::read_to_string(&path).unwrap();
let signature = find_type(&markdown);
format!("{:#?}", signature)
})
}
#[test]
fn test_bulk() {
dir_tests("bulk", "json", |path| {

View File

@ -1,6 +1,6 @@
[
{
"name": "lib.lists.foldl'",
"content": "\nReduce a list by applying a binary operator from left to right,\nstarting with an initial accumulator.\nBefore each application of the operator, the accumulator value is evaluated.\nThis behavior makes this function stricter than [`foldl`](#function-library-lib.lists.foldl).\nUnlike [`builtins.foldl'`](https://nixos.org/manual/nix/unstable/language/builtins.html#builtins-foldl'),\nthe initial accumulator argument is evaluated before the first iteration.\n A call like\n ```nix\n foldl' op acc₀ [ x₀ x₁ x₂ ... xₙ₋₁ xₙ ]\n ```\n is (denotationally) equivalent to the following,\n but with the added benefit that `foldl'` itself will never overflow the stack.\n ```nix\n let\n acc₁ = builtins.seq acc₀ (op acc₀ x₀ );\n acc₂ = builtins.seq acc₁ (op acc₁ x₁ );\n acc₃ = builtins.seq acc₂ (op acc₂ x₂ );\n ...\n accₙ = builtins.seq accₙ₋₁ (op accₙ₋₁ xₙ₋₁);\n accₙ₊₁ = builtins.seq accₙ (op accₙ xₙ );\n in\n accₙ₊₁\n # Or ignoring builtins.seq\n op (op (... (op (op (op acc₀ x₀) x₁) x₂) ...) xₙ₋₁) xₙ\n ```\n\n # Example\n\n ```nix\n foldl' (acc: x: acc + x) 0 [1 2 3]\n => 6\n ```\n\n # Type\n\n ```\n foldl' :: (acc -> x -> acc) -> acc -> [x] -> acc\n ```\n\n # Arguments\n\n - [op] The binary operation to run, where the two arguments are:\n\n1. `acc`: The current accumulator value: Either the initial one for the first iteration, or the result of the previous iteration\n2. `x`: The corresponding list element for this iteration\n - [acc] The initial accumulator value\n - [list] The list to fold\n\n"
"content": "\n Reduce a list by applying a binary operator from left to right,\n starting with an initial accumulator.\n Before each application of the operator, the accumulator value is evaluated.\n This behavior makes this function stricter than [`foldl`](#function-library-lib.lists.foldl).\n Unlike [`builtins.foldl'`](https://nixos.org/manual/nix/unstable/language/builtins.html#builtins-foldl'),\n the initial accumulator argument is evaluated before the first iteration.\n A call like\n ```nix\n foldl' op acc₀ [ x₀ x₁ x₂ ... xₙ₋₁ xₙ ]\n ```\n is (denotationally) equivalent to the following,\n but with the added benefit that `foldl'` itself will never overflow the stack.\n ```nix\n let\n acc₁ = builtins.seq acc₀ (op acc₀ x₀ );\n acc₂ = builtins.seq acc₁ (op acc₁ x₁ );\n acc₃ = builtins.seq acc₂ (op acc₂ x₂ );\n ...\n accₙ = builtins.seq accₙ₋₁ (op accₙ₋₁ xₙ₋₁);\n accₙ₊₁ = builtins.seq accₙ (op accₙ xₙ );\n in\n accₙ₊₁\n # Or ignoring builtins.seq\n op (op (... (op (op (op acc₀ x₀) x₁) x₂) ...) xₙ₋₁) xₙ\n ```\n\n # Example\n\n ```nix\n foldl' (acc: x: acc + x) 0 [1 2 3]\n => 6\n ```\n\n # Type\n\n ```\n foldl' :: (acc -> x -> acc) -> acc -> [x] -> acc\n ```\n\n # Arguments\n\n - [op] The binary operation to run, where the two arguments are:\n\n1. `acc`: The current accumulator value: Either the initial one for the first iteration, or the result of the previous iteration\n2. `x`: The corresponding list element for this iteration\n - [acc] The initial accumulator value\n - [list] The list to fold\n\n"
}
]

View File

@ -0,0 +1,3 @@
Some(
"foo :: String -> Bool\n",
)

View File

@ -0,0 +1,5 @@
# Type
```typed-nix
foo :: String -> Bool
```

View File

@ -0,0 +1,3 @@
Some(
"foo :: String -> Bool\n",
)

View File

@ -0,0 +1,11 @@
# no type
```typed-nix
Not shown
```
# type
```typed-nix
foo :: String -> Bool
```

View File

@ -0,0 +1,3 @@
Some(
"foo :: { foo :: a} -> a\n",
)

View File

@ -0,0 +1,26 @@
## Example
Lorem ipsum
## Some other type heading
Lorem ipsum
# Invalid H1
Lorem ipsum
## Type
Lorem ipsum
- Item1
- Item2
```
foo :: { foo :: a} -> a
```
```
irrelevant
```

View File

@ -27,6 +27,19 @@ let
"x86_64-darwin" = "@next/swc-darwin-x64";
"aarch64-darwin" = "@next/swc-darwin-arm64";
}.${config.floco.settings.system};
# example: "13.4.2"
pagefindVersion = builtins.head (builtins.attrNames
(lib.filterAttrs (name: _attrs: name == "pagefind") config.floco.pdefs).pagefind);
# we must change the precompiled swc binary depending on the curerent system.
# example: "@next/swc-linux-x64-gnu"
pagefindArch = {
"x86_64-linux" = "@pagefind/linux-x64";
"aarch64-linux" = "@pagefind/linux-arm64";
"x86_64-darwin" = "@pagefind/darwin-x64";
"aarch64-darwin" = "@pagefind/darwin-arm64";
}.${config.floco.settings.system};
in
{
config.floco.packages.${ident}.${version} =
@ -63,6 +76,12 @@ in
optional = false;
dev = true;
};
"node_modules/${pagefindArch}" = {
key = "${pagefindArch}/${pagefindVersion}";
link = false;
optional = false;
dev = true;
};
# We can inject dependencies here
#
};

View File

@ -1,6 +1,6 @@
import { HighlightBaseline } from "@/components/HighlightBaseline";
import { ShareButton } from "@/components/ShareButton";
import { BackButton } from "@/components/back";
import { BackButton } from "@/components/BackButton";
import { Doc, FilePosition, data } from "@/models/data";
import { getPrimopDescription } from "@/models/primop";
import { extractHeadings, mdxRenderOptions } from "@/utils";
@ -39,6 +39,7 @@ const Toc = async (props: TocProps) => {
return (
<Box
data-pagefind-ignore="all"
sx={{
display: {
xs: "none",
@ -97,34 +98,37 @@ export default async function Page(props: { params: { path: string[] } }) {
<HighlightBaseline />
<Box>
<Box sx={{ display: "flex" }}>
<BackButton />
<Typography
variant="h2"
component={"h1"}
sx={{ marginRight: "auto" }}
>
<BackButton /> {item?.meta.title}
{meta?.is_primop && meta.count_applied == 0 && (
<>
{item?.meta.title}
</Typography>
{meta?.is_primop && meta.count_applied == 0 && (
<>
<Chip
label="Primop"
color="primary"
sx={{ ml: 2, maxWidth: "10rem" }}
/>
{meta?.primop_meta?.experimental && (
<Chip
label="Primop"
color="primary"
label={"Experimental"}
color="warning"
sx={{ ml: 2, maxWidth: "10rem" }}
/>
{meta?.primop_meta?.experimental && (
<Chip
label={"Experimental"}
color="warning"
sx={{ ml: 2, maxWidth: "10rem" }}
/>
)}
</>
)}
</Typography>
)}
</>
)}
<ShareButton />
</Box>
<Divider flexItem sx={{ mt: 2 }} />
<Box sx={{ display: "none" }}>
<span data-pagefind-filter={`type-from:Any`} />
<span data-pagefind-filter={`type-to:Any`} />
</Box>
<MDXRemote
options={{
parseFrontmatter: true,
@ -181,6 +185,7 @@ export default async function Page(props: { params: { path: string[] } }) {
)}
>
<Button
data-pagefind-ignore="all"
variant="text"
sx={{ textTransform: "none", my: 1, placeSelf: "start" }}
startIcon={<Edit />}
@ -212,12 +217,7 @@ export default async function Page(props: { params: { path: string[] } }) {
<ul>
{meta?.aliases?.map((a) => (
<li key={a.join(".")}>
<Link
href={`/f/${a.join("/")}`}
// sx={{ color: "primary.main" }}
>
{a.join(".")}
</Link>
<Link href={`/f/${a.join("/")}`}>{a.join(".")}</Link>
</li>
))}
</ul>

View File

@ -0,0 +1,16 @@
import { Box } from "@mui/material";
import localFont from "next/font/local";
const fira = localFont({
src: "../fonts/FiraCode-VF.ttf",
display: "swap",
});
export default function NotFoundPage() {
return (
<Box data-pagefind-ignore="all" className={fira.className}>
Page not found
</Box>
);
}

View File

@ -5,7 +5,7 @@ import { Box, Typography, Link } from "@mui/material";
import localFont from "next/font/local";
const orbitron = localFont({
const fira = localFont({
src: "../fonts/FiraCode-VF.ttf",
display: "swap",
});
@ -24,7 +24,7 @@ export default function Home() {
<Link href="/" underline="none">
<Typography
variant="h1"
className={orbitron.className}
className={fira.className}
sx={{
mt: 10,
mb: 4,

View File

@ -1,12 +1,15 @@
"use client";
import { SearchResults } from "@/components/SearchResults";
// import { PagefindSearch } from "@/components/Pagefind";
import { PagefindResults } from "@/components/PagefindResults";
// import { SearchResults } from "@/components/SearchResults";
import { LinearProgress } from "@mui/material";
import { Suspense } from "react";
export default function Q() {
return (
<Suspense fallback={<LinearProgress />}>
<SearchResults />
<PagefindResults />
{/* <SearchResults /> */}
</Suspense>
);
}

View File

@ -0,0 +1,94 @@
"use client";
import { useEffect, useState } from "react";
export type Filters = {
[name: string]: string[];
};
export type RawResult = {
data: () => Promise<PagefindResult>;
id: string;
score: number;
};
export type PagefindResult = {
url: string;
content: string;
word_count: number;
filters: Filters;
meta: {
title: string;
};
anchors: string[];
raw_content: string;
raw_url: string;
excerpt: string;
sub_results: any[];
};
type PagefindHooks = {
search: (
term: string,
options?: {
filters?: Filters;
}
) =>
| Promise<{
results: RawResult[];
}>
| undefined;
pagefind: any | undefined;
};
export const usePagefindSearch = (): PagefindHooks => {
const [pagefind, setPagefind] = useState();
useEffect(() => {
const init = async () => {
// @ts-ignore
if (!window?.pagefind) {
const pagefind = await import(
// @ts-ignore
/* webpackIgnore: true */ "/pagefind/pagefind.js"
);
// @ts-ignore
window.pagefind = pagefind;
}
// @ts-ignore
setPagefind(window.pagefind);
};
init();
}, []);
// @ts-ignore
console.log("usePagefind", { pagefind });
return {
// @ts-ignore
search: pagefind?.search,
// @ts-ignore
pagefind,
};
};
// {
// "url": "/f/builtins/dirOf.html",
// "content": "builtins.dirOf Primop. Takes 1 arguments. s. Return the directory part of the string s, that is, everything before the final slash in the string. This is similar to the GNU dirname command.",
// "word_count": 32,
// "filters": {
// "type-to": [
// "Any"
// ],
// "type-from": [
// "Any"
// ]
// },
// "meta": {
// "title": "builtins.dirOf Primop."
// },
// "anchors": [],
// "weighted_locations": [],
// "locations": [],
// "raw_content": "builtins.dirOf Primop. Takes 1 arguments. s. Return the directory part of the string s, that is, everything before the final slash in the string. This is similar to the GNU dirname command.",
// "raw_url": "/f/builtins/dirOf.html",
// "excerpt": "builtins.dirOf Primop. Takes 1 arguments. s. Return the directory part of the string s, that is, everything before the final slash in the string. This is similar to the GNU",
// "sub_results": []
// }

View File

@ -0,0 +1,175 @@
"use client";
import {
Box,
Container,
Divider,
LinearProgress,
Link,
List,
ListItem,
ListItemText,
TablePagination,
Typography,
useMediaQuery,
useTheme,
} from "@mui/material";
import React, { useEffect, useMemo, useState } from "react";
// import { useMiniSearch } from "react-minisearch";
// import { Doc, data } from "@/models/data";
import { EmptyRecordsPlaceholder } from "./emptyRecordsPlaceholder";
import { useSearchParams } from "next/navigation";
// import { Excerpt } from "./Excerpt";
import { useRouter } from "next/navigation";
import { PagefindResult, RawResult, usePagefindSearch } from "./Pagefind";
export type BasicListItem = {
item: React.ReactNode;
key: string;
};
const useMobile = () => useMediaQuery(useTheme().breakpoints.down("md"));
// interface SearchResultsProps {
// pageItems: PagefindResult[];
// }
export function PagefindResults() {
const params = useSearchParams();
const router = useRouter();
const query = useMemo(() => new URLSearchParams(params), [params]);
const page = +params.get("page")! || 1;
const itemsPerPage = +params.get("limit")! || 10;
const term = params.get("term") || "";
const isMobile = useMobile();
const [searchResults, setSearchResults] = useState<null | RawResult[]>(null);
const [items, setItems] = useState<null | PagefindResult[]>(null);
const { search } = usePagefindSearch();
useEffect(() => {
const init = async () => {
console.log({ search });
if (search) {
let raw = await search(term);
setSearchResults(raw?.results || []);
}
};
init();
}, [term, search]);
const handleChangeRowsPerPage = (
event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
query.set("limit", event.target.value);
query.set("page", "1");
router.push(`?${query.toString()}`);
};
const pageItems = useMemo(() => {
const items = searchResults || [];
const startIdx = (page - 1) * itemsPerPage;
const endIdx = page * itemsPerPage;
return items.slice(startIdx, endIdx);
}, [page, itemsPerPage, searchResults]);
useEffect(() => {
const loadData = async () => {
let items = await Promise.all(pageItems.map(async (r) => await r.data()));
setItems(items);
};
loadData();
}, [pageItems]);
const handlePageChange = (
event: React.MouseEvent<HTMLButtonElement> | null,
value: number
) => {
query.set("page", (value + 1).toString());
router.push(`?${query.toString()}`);
};
return (
<Box
sx={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<Container maxWidth="lg">
{items === null ? (
<LinearProgress sx={{ my: 2 }} />
) : (
<>
<Typography
variant="subtitle1"
sx={{ color: "text.secondary", p: 1 }}
>
{searchResults?.length} Results
</Typography>
<List aria-label="basic-list" sx={{ pt: 0, width: "100%" }}>
{items.length ? (
items.map(({ meta, excerpt, url }, idx) => (
<Box key={`${idx}`}>
<ListItem sx={{ px: 0 }} aria-label={`item-${idx}`}>
<ListItemText
primaryTypographyProps={{
variant: "h5",
component: "h2",
}}
secondaryTypographyProps={{
variant: "body1",
}}
primary={<Link href={`${url}`}>{meta.title}</Link>}
secondary={
<div dangerouslySetInnerHTML={{ __html: excerpt }} />
}
/>
</ListItem>
<Divider
flexItem
orientation="horizontal"
sx={{ p: 1, mx: 1 }}
/>
</Box>
))
) : (
<Box sx={{ mt: 3 }}>
<EmptyRecordsPlaceholder
CardProps={{
sx: { backgroundColor: "inherit" },
}}
title={"No search results found"}
subtitle={
"Maybe the function does not exist or is not documented."
}
/>
</Box>
)}
</List>
<TablePagination
component={"div"}
sx={{ display: "flex", justifyContent: "center", mt: 1, mb: 10 }}
count={searchResults?.length || -1}
color="primary"
page={page - 1}
onPageChange={handlePageChange}
rowsPerPage={itemsPerPage}
labelRowsPerPage={"per Page"}
rowsPerPageOptions={[10, 20, 50, 100]}
onRowsPerPageChange={handleChangeRowsPerPage}
showFirstButton={!isMobile}
showLastButton={!isMobile}
/>
</>
)}
</Container>
</Box>
);
}

View File

@ -1,11 +0,0 @@
.hljs {
padding-left: 0 !important;
padding-top: 0 !important;
}
.hljs .pre {
width: 100%;
}
.hljs .nix {
overflow-x: scroll;
}

View File

@ -1,46 +0,0 @@
import { Box } from "@mui/material";
import { ThemeOptions } from "@mui/system";
import { useEffect } from "react";
import Highlight, { HighlightProps } from "react-highlight";
import styles from "./codeHighlight.module.css";
interface CodeHighlightProps {
theme: "light" | "dark";
code: HighlightProps["children"];
lang?: string;
background?: ThemeOptions["palette"] | string;
}
export const CodeHighlight = (props: CodeHighlightProps) => {
const { theme, code, lang, background } = props;
useEffect(() => {
if (theme === "dark") {
// @ts-ignore - don't check type of css module
import("highlight.js/styles/github-dark.css");
} else {
// @ts-ignore - don't check type of css module
import("highlight.js/styles/github.css");
}
}, [theme]);
return (
<Box
sx={{
"&.MuiBox-root": {
width: "100%",
margin: 0,
},
"&.MuiBox-root>pre": {
margin: 0,
},
"&.MuiBox-root>pre code.hljs": {
bgcolor: background || undefined,
},
}}
>
<Highlight className={`${lang || "nix"} ${styles.hljs}`}>
{code}
</Highlight>
</Box>
);
};

View File

@ -1 +0,0 @@
export {CodeHighlight} from "./codeHighlight"

File diff suppressed because it is too large Load Diff