From c72644f86770350cb073269dd1d4820a72fd3236 Mon Sep 17 00:00:00 2001 From: cui Date: Wed, 26 Nov 2025 17:47:24 +0800 Subject: [PATCH] fix: docs link in https://reth.rs/cli/cli (#19961) --- docs/cli/help.rs | 2 +- docs/vocs/docs/pages/cli/SUMMARY.mdx | 106 +++++++++++++-------------- docs/vocs/vocs.config.ts | 30 ++++++++ 3 files changed, 84 insertions(+), 54 deletions(-) diff --git a/docs/cli/help.rs b/docs/cli/help.rs index badd10e169..a3a71514e5 100755 --- a/docs/cli/help.rs +++ b/docs/cli/help.rs @@ -235,7 +235,7 @@ fn cmd_summary(cmd: &Cmd, indent: usize) -> String { let cmd_s = cmd.to_string(); let cmd_path = cmd_s.replace(" ", "/"); let indent_string = " ".repeat(indent + (cmd.subcommands.len() * 2)); - format!("{}- [`{}`](../cli/{}.mdx)\n", indent_string, cmd_s, cmd_path) + format!("{}- [`{}`](./{}.mdx)\n", indent_string, cmd_s, cmd_path) } /// Overwrites the root SUMMARY.mdx file with the generated content. diff --git a/docs/vocs/docs/pages/cli/SUMMARY.mdx b/docs/vocs/docs/pages/cli/SUMMARY.mdx index cf8def9114..6c54509ba6 100644 --- a/docs/vocs/docs/pages/cli/SUMMARY.mdx +++ b/docs/vocs/docs/pages/cli/SUMMARY.mdx @@ -1,53 +1,53 @@ - - [`reth`](../cli/reth.mdx) - - [`reth node`](../cli/reth/node.mdx) - - [`reth init`](../cli/reth/init.mdx) - - [`reth init-state`](../cli/reth/init-state.mdx) - - [`reth import`](../cli/reth/import.mdx) - - [`reth import-era`](../cli/reth/import-era.mdx) - - [`reth export-era`](../cli/reth/export-era.mdx) - - [`reth dump-genesis`](../cli/reth/dump-genesis.mdx) - - [`reth db`](../cli/reth/db.mdx) - - [`reth db stats`](../cli/reth/db/stats.mdx) - - [`reth db list`](../cli/reth/db/list.mdx) - - [`reth db checksum`](../cli/reth/db/checksum.mdx) - - [`reth db diff`](../cli/reth/db/diff.mdx) - - [`reth db get`](../cli/reth/db/get.mdx) - - [`reth db get mdbx`](../cli/reth/db/get/mdbx.mdx) - - [`reth db get static-file`](../cli/reth/db/get/static-file.mdx) - - [`reth db drop`](../cli/reth/db/drop.mdx) - - [`reth db clear`](../cli/reth/db/clear.mdx) - - [`reth db clear mdbx`](../cli/reth/db/clear/mdbx.mdx) - - [`reth db clear static-file`](../cli/reth/db/clear/static-file.mdx) - - [`reth db repair-trie`](../cli/reth/db/repair-trie.mdx) - - [`reth db static-file-header`](../cli/reth/db/static-file-header.mdx) - - [`reth db static-file-header block`](../cli/reth/db/static-file-header/block.mdx) - - [`reth db static-file-header path`](../cli/reth/db/static-file-header/path.mdx) - - [`reth db version`](../cli/reth/db/version.mdx) - - [`reth db path`](../cli/reth/db/path.mdx) - - [`reth db settings`](../cli/reth/db/settings.mdx) - - [`reth db settings get`](../cli/reth/db/settings/get.mdx) - - [`reth db settings set`](../cli/reth/db/settings/set.mdx) - - [`reth db settings set receipts_in_static_files`](../cli/reth/db/settings/set/receipts_in_static_files.mdx) - - [`reth db settings set transaction_senders_in_static_files`](../cli/reth/db/settings/set/transaction_senders_in_static_files.mdx) - - [`reth db account-storage`](../cli/reth/db/account-storage.mdx) - - [`reth download`](../cli/reth/download.mdx) - - [`reth stage`](../cli/reth/stage.mdx) - - [`reth stage run`](../cli/reth/stage/run.mdx) - - [`reth stage drop`](../cli/reth/stage/drop.mdx) - - [`reth stage dump`](../cli/reth/stage/dump.mdx) - - [`reth stage dump execution`](../cli/reth/stage/dump/execution.mdx) - - [`reth stage dump storage-hashing`](../cli/reth/stage/dump/storage-hashing.mdx) - - [`reth stage dump account-hashing`](../cli/reth/stage/dump/account-hashing.mdx) - - [`reth stage dump merkle`](../cli/reth/stage/dump/merkle.mdx) - - [`reth stage unwind`](../cli/reth/stage/unwind.mdx) - - [`reth stage unwind to-block`](../cli/reth/stage/unwind/to-block.mdx) - - [`reth stage unwind num-blocks`](../cli/reth/stage/unwind/num-blocks.mdx) - - [`reth p2p`](../cli/reth/p2p.mdx) - - [`reth p2p header`](../cli/reth/p2p/header.mdx) - - [`reth p2p body`](../cli/reth/p2p/body.mdx) - - [`reth p2p rlpx`](../cli/reth/p2p/rlpx.mdx) - - [`reth p2p rlpx ping`](../cli/reth/p2p/rlpx/ping.mdx) - - [`reth p2p bootnode`](../cli/reth/p2p/bootnode.mdx) - - [`reth config`](../cli/reth/config.mdx) - - [`reth prune`](../cli/reth/prune.mdx) - - [`reth re-execute`](../cli/reth/re-execute.mdx) \ No newline at end of file + - [`reth`](./reth.mdx) + - [`reth node`](./reth/node.mdx) + - [`reth init`](./reth/init.mdx) + - [`reth init-state`](./reth/init-state.mdx) + - [`reth import`](./reth/import.mdx) + - [`reth import-era`](./reth/import-era.mdx) + - [`reth export-era`](./reth/export-era.mdx) + - [`reth dump-genesis`](./reth/dump-genesis.mdx) + - [`reth db`](./reth/db.mdx) + - [`reth db stats`](./reth/db/stats.mdx) + - [`reth db list`](./reth/db/list.mdx) + - [`reth db checksum`](./reth/db/checksum.mdx) + - [`reth db diff`](./reth/db/diff.mdx) + - [`reth db get`](./reth/db/get.mdx) + - [`reth db get mdbx`](./reth/db/get/mdbx.mdx) + - [`reth db get static-file`](./reth/db/get/static-file.mdx) + - [`reth db drop`](./reth/db/drop.mdx) + - [`reth db clear`](./reth/db/clear.mdx) + - [`reth db clear mdbx`](./reth/db/clear/mdbx.mdx) + - [`reth db clear static-file`](./reth/db/clear/static-file.mdx) + - [`reth db repair-trie`](./reth/db/repair-trie.mdx) + - [`reth db static-file-header`](./reth/db/static-file-header.mdx) + - [`reth db static-file-header block`](./reth/db/static-file-header/block.mdx) + - [`reth db static-file-header path`](./reth/db/static-file-header/path.mdx) + - [`reth db version`](./reth/db/version.mdx) + - [`reth db path`](./reth/db/path.mdx) + - [`reth db settings`](./reth/db/settings.mdx) + - [`reth db settings get`](./reth/db/settings/get.mdx) + - [`reth db settings set`](./reth/db/settings/set.mdx) + - [`reth db settings set receipts_in_static_files`](./reth/db/settings/set/receipts_in_static_files.mdx) + - [`reth db settings set transaction_senders_in_static_files`](./reth/db/settings/set/transaction_senders_in_static_files.mdx) + - [`reth db account-storage`](./reth/db/account-storage.mdx) + - [`reth download`](./reth/download.mdx) + - [`reth stage`](./reth/stage.mdx) + - [`reth stage run`](./reth/stage/run.mdx) + - [`reth stage drop`](./reth/stage/drop.mdx) + - [`reth stage dump`](./reth/stage/dump.mdx) + - [`reth stage dump execution`](./reth/stage/dump/execution.mdx) + - [`reth stage dump storage-hashing`](./reth/stage/dump/storage-hashing.mdx) + - [`reth stage dump account-hashing`](./reth/stage/dump/account-hashing.mdx) + - [`reth stage dump merkle`](./reth/stage/dump/merkle.mdx) + - [`reth stage unwind`](./reth/stage/unwind.mdx) + - [`reth stage unwind to-block`](./reth/stage/unwind/to-block.mdx) + - [`reth stage unwind num-blocks`](./reth/stage/unwind/num-blocks.mdx) + - [`reth p2p`](./reth/p2p.mdx) + - [`reth p2p header`](./reth/p2p/header.mdx) + - [`reth p2p body`](./reth/p2p/body.mdx) + - [`reth p2p rlpx`](./reth/p2p/rlpx.mdx) + - [`reth p2p rlpx ping`](./reth/p2p/rlpx/ping.mdx) + - [`reth p2p bootnode`](./reth/p2p/bootnode.mdx) + - [`reth config`](./reth/config.mdx) + - [`reth prune`](./reth/prune.mdx) + - [`reth re-execute`](./reth/re-execute.mdx) \ No newline at end of file diff --git a/docs/vocs/vocs.config.ts b/docs/vocs/vocs.config.ts index 8664eedd3b..a2d7efa9ad 100644 --- a/docs/vocs/vocs.config.ts +++ b/docs/vocs/vocs.config.ts @@ -72,5 +72,35 @@ export default defineConfig({ }, editLink: { pattern: "https://github.com/paradigmxyz/reth/edit/main/docs/vocs/docs/pages/:path", + }, + vite: { + plugins: [ + { + name: 'transform-summary-links', + apply: 'serve', // only during dev for faster feedback + enforce: 'pre', + async load(id) { + if (id.endsWith('pages/cli/SUMMARY.mdx') || id.endsWith('pages/cli/summary.mdx')) { + const { readFileSync } = await import('node:fs') + let code = readFileSync(id, 'utf-8') + code = code.replace(/\]\(\.\/([^)]+)\.mdx\)/g, '](/cli/\$1)') + return code + } + } + }, + { + name: 'transform-summary-links-build', + apply: 'build', // only apply during build + enforce: 'pre', + async load(id) { + if (id.endsWith('pages/cli/SUMMARY.mdx') || id.endsWith('pages/cli/summary.mdx')) { + const { readFileSync } = await import('node:fs') + let code = readFileSync(id, 'utf-8') + code = code.replace(/\]\(\.\/([^)]+)\.mdx\)/g, '](/cli/\$1)') + return code + } + } + } + ] } })