toolkit for mdBook [mirror of my GitHub repo] docs.tonywu.dev/mdbookkit/
permalinks rust-analyzer mdbook
0
fork

Configure Feed

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

chore(ci): setup binary build

+177 -38
+125
.github/workflows/bin.yml
··· 1 + name: Build binaries 2 + 3 + permissions: 4 + contents: write 5 + 6 + on: 7 + release: 8 + types: 9 + - published 10 + 11 + push: 12 + branches: 13 + - main 14 + 15 + workflow_dispatch: 16 + 17 + env: 18 + CARGO_INCREMENTAL: 0 19 + CARGO_NET_GIT_FETCH_WITH_CLI: true 20 + CARGO_NET_RETRY: 10 21 + CARGO_TERM_COLOR: always 22 + RUST_BACKTRACE: 1 23 + RUSTFLAGS: -D warnings 24 + RUSTUP_MAX_RETRIES: 10 25 + 26 + concurrency: 27 + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} 28 + cancel-in-progress: true 29 + 30 + jobs: 31 + build: 32 + name: ${{ matrix.target }} 33 + 34 + strategy: 35 + fail-fast: false 36 + matrix: 37 + include: 38 + - target: aarch64-unknown-linux-gnu 39 + os: ubuntu-latest 40 + - target: x86_64-unknown-linux-gnu 41 + os: ubuntu-latest 42 + - target: aarch64-apple-darwin 43 + os: macos-latest 44 + - target: x86_64-apple-darwin 45 + os: macos-latest 46 + - target: aarch64-pc-windows-msvc 47 + os: windows-latest 48 + - target: x86_64-pc-windows-msvc 49 + os: windows-latest 50 + 51 + runs-on: ${{ matrix.os }} 52 + 53 + if: ${{ github.repository_owner == 'tonywu6' }} 54 + timeout-minutes: 60 55 + 56 + steps: 57 + - uses: actions/checkout@v4 58 + - uses: dtolnay/rust-toolchain@stable 59 + 60 + - uses: taiki-e/setup-cross-toolchain-action@v1 61 + with: 62 + target: ${{ matrix.target }} 63 + if: startsWith(matrix.os, 'ubuntu') 64 + 65 + - name: Get cache key 66 + run: | 67 + CARGO_VERSION=$(cargo --version) 68 + echo "CACHE_KEY=${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-${{github.workflow}}-${{github.job}}" >> "$GITHUB_OUTPUT" 69 + { 70 + echo "CACHE_KEY_RESTORE<<EOF" 71 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-${{hashFiles('**/Cargo.lock')}}-" 72 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-${{hashFiles('**/Cargo.toml')}}-" 73 + echo "${{runner.os}}-${{runner.arch}}-$CARGO_VERSION-" 74 + echo "EOF" 75 + } >> "$GITHUB_OUTPUT" 76 + id: cache-key 77 + shell: bash 78 + 79 + - uses: actions/cache/restore@v4 80 + with: 81 + path: | 82 + target/ 83 + key: ${{ steps.cache-key.outputs.CACHE_KEY }} 84 + restore-keys: ${{ steps.cache-key.outputs.CACHE_KEY_RESTORE }} 85 + id: cache-restore 86 + 87 + - name: Build rustdoc-link 88 + uses: taiki-e/upload-rust-binary-action@v1 89 + with: 90 + target: ${{ matrix.target }} 91 + bin: mdbook-rustdoc-link 92 + features: rustdoc-link 93 + tar: unix 94 + zip: windows 95 + codesign: "-" # https://developer.apple.com/documentation/security/seccodesignatureflags/adhoc 96 + token: ${{ secrets.GITHUB_TOKEN }} 97 + dry-run: ${{ github.event_name != 'release' }} 98 + 99 + - name: Build link-forever 100 + uses: taiki-e/upload-rust-binary-action@v1 101 + with: 102 + target: ${{ matrix.target }} 103 + bin: mdbook-link-forever 104 + features: link-forever 105 + tar: unix 106 + zip: windows 107 + codesign: "-" 108 + token: ${{ secrets.GITHUB_TOKEN }} 109 + dry-run: ${{ github.event_name != 'release' }} 110 + 111 + - uses: actions/upload-artifact@v4 112 + with: 113 + path: | 114 + target/${{ matrix.target }}/release/mdbook-rustdoc-link 115 + target/${{ matrix.target }}/release/mdbook-link-forever 116 + name: ${{ matrix.target }} 117 + retention-days: 1 118 + if: github.event_name != 'release' 119 + 120 + - uses: actions/cache/save@v4 121 + if: always() 122 + with: 123 + path: | 124 + target 125 + key: ${{ steps.cache-key.outputs.CACHE_KEY }}
+5
.github/workflows/ci.yml
··· 15 15 env: 16 16 CARGO_TERM_COLOR: always 17 17 18 + concurrency: 19 + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} 20 + cancel-in-progress: true 21 + 18 22 jobs: 19 23 test: 20 24 name: Test ··· 69 73 - name: Evict cache 70 74 run: gh cache delete '${{ steps.cache-key.outputs.CACHE_KEY }}' 71 75 if: ${{ steps.cache-restore.outputs.cache-hit }} 76 + continue-on-error: true 72 77 env: 73 78 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 74 79
+12 -1
.github/workflows/docs.yml
··· 5 5 branches: 6 6 - main 7 7 8 + pull_request: 9 + branches: 10 + - main 11 + 8 12 release: 9 13 types: 10 14 - published 11 15 16 + workflow_dispatch: 17 + 12 18 env: 13 19 CARGO_TERM_COLOR: always 20 + 21 + concurrency: 22 + group: ${{ github.workflow }}-${{ github.ref }} 23 + cancel-in-progress: true 14 24 15 25 jobs: 16 26 build: ··· 66 76 path: docs/dist 67 77 68 78 deploy: 79 + name: Deploy 69 80 runs-on: ubuntu-latest 70 81 71 82 needs: build 72 83 73 - if: ${{ github.event_name == 'release' && !github.event.release.prerelease && github.repository_owner == 'tonywu6' }} 84 + if: (github.event_name == 'workflow_dispatch' || github.event_name == 'release' && !github.event.release.prerelease) && github.repository_owner == 'tonywu6' 74 85 75 86 permissions: 76 87 pages: write
+3 -3
.github/workflows/release-plz.yml
··· 17 17 name: Pull request 18 18 runs-on: ubuntu-latest 19 19 20 - if: ${{ github.repository_owner == 'tonywu6' }} 20 + if: github.repository_owner == 'tonywu6' 21 21 22 22 permissions: 23 23 contents: write ··· 46 46 # name: Release 47 47 # runs-on: ubuntu-latest 48 48 49 - # if: ${{ github.repository_owner == 'tonywu6' }} 49 + # if: github.repository_owner == 'tonywu6' 50 50 51 51 # permissions: 52 52 # contents: write ··· 60 60 # with: 61 61 # command: release 62 62 # env: 63 - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 63 + # GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_GITHUB_TOKEN }} 64 64 # CARGO_REGISTRY_TOKEN: ${{ secrets.RELEASE_PLZ_PUBLISH_TOKEN }}
+1 -19
Cargo.lock
··· 860 860 "libc", 861 861 "libgit2-sys", 862 862 "log", 863 - "openssl-probe", 864 - "openssl-sys", 865 863 "url", 866 864 ] 867 865 ··· 1423 1421 dependencies = [ 1424 1422 "cc", 1425 1423 "libc", 1426 - "libssh2-sys", 1427 1424 "libz-sys", 1428 - "openssl-sys", 1429 1425 "pkg-config", 1430 1426 ] 1431 1427 ··· 1437 1433 dependencies = [ 1438 1434 "bitflags 2.9.0", 1439 1435 "libc", 1440 - ] 1441 - 1442 - [[package]] 1443 - name = "libssh2-sys" 1444 - version = "0.3.1" 1445 - source = "registry+https://github.com/rust-lang/crates.io-index" 1446 - checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" 1447 - dependencies = [ 1448 - "cc", 1449 - "libc", 1450 - "libz-sys", 1451 - "openssl-sys", 1452 - "pkg-config", 1453 - "vcpkg", 1454 1436 ] 1455 1437 1456 1438 [[package]] ··· 1561 1543 1562 1544 [[package]] 1563 1545 name = "mdbookkit" 1564 - version = "0.1.0" 1546 + version = "1.0.0" 1565 1547 dependencies = [ 1566 1548 "anyhow", 1567 1549 "async-lsp",
+1 -1
README.md
··· 5 5 ## [Read the book](https://tonywu6.github.io/mdbookkit) 6 6 7 7 [![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit) 8 - [![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit) 8 + [![documentation](https://img.shields.io/github/actions/workflow/status/tonywu6/mdbookkit/docs.yml?branch=main&event=release&style=flat-square&label=docs)](https://docs.rs/mdbookkit) 9 9 [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](/LICENSE-APACHE.md)
+12
crates/mdbookkit/CHANGELOG.md
··· 1 + # Changelog 2 + 3 + All notable changes to this project will be documented in this file. 4 + 5 + The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and 6 + this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 + 8 + ## [Unreleased] 9 + 10 + ## [1.0.0](https://tonywu6.github.com/tonywu6/mdbookkit/releases/tag/mdbookkit-v1.0.0) - 2025-04-03 11 + 12 + Initial release.
+10 -7
crates/mdbookkit/Cargo.toml
··· 1 1 [package] 2 2 name = "mdbookkit" 3 3 publish = true 4 - version = "0.1.0" 4 + version = "1.0.0" 5 + 6 + edition.workspace = true 7 + rust-version.workspace = true 5 8 6 9 authors.workspace = true 7 - description = "Toolkit for mdBook." 8 10 license.workspace = true 9 - readme = "README.md" 10 11 repository.workspace = true 11 12 12 - edition.workspace = true 13 - rust-version.workspace = true 13 + categories = ["command-line-utilities"] 14 + description = "toolkit for mdBook 📖" 15 + documentation = "https://tonywu6.github.io/mdbookkit/" 16 + keywords = ["mdbook", "documentation", "rust-analyzer", "lsp", "permalink"] 17 + readme = "README.md" 14 18 15 19 autobins = false 16 20 autotests = false ··· 26 30 console = { version = "0.15.11", optional = true } 27 31 dirs = { version = "6.0.0", optional = true } 28 32 env_logger = { workspace = true, optional = true } 29 - git2 = { version = "0.20.1", optional = true } 33 + git2 = { version = "0.20.1", default-features = false, optional = true } 30 34 gix-url = { version = "0.29.0", optional = true } 31 35 indicatif = { version = "0.17.11", optional = true } 32 36 log = { workspace = true } ··· 109 113 default = [] 110 114 111 115 # aliases 112 - 113 116 mdbook-link-forever = ["link-forever"] 114 117 mdbook-rustdoc-link = ["rustdoc-link"] 115 118
+1 -1
crates/mdbookkit/README.md
··· 3 3 ![mdbookkit hero image](/docs/src/media/banner.webp) 4 4 5 5 [![crates.io](https://img.shields.io/crates/v/mdbookkit?style=flat-square)](https://crates.io/crates/mdbookkit) 6 - [![documentation](https://img.shields.io/docsrs/mdbookkit?style=flat-square&label=docs.rs)](https://docs.rs/mdbookkit) 6 + [![documentation](https://img.shields.io/github/actions/workflow/status/tonywu6/mdbookkit/docs.yml?branch=main&event=release&style=flat-square&label=docs)](https://docs.rs/mdbookkit) 7 7 [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/mdbookkit?style=flat-square)](/LICENSE-APACHE.md) 8 8 9 9 Quality-of-life plugins for your [mdBook] project.
+3 -2
crates/mdbookkit/tests/snaps/rustdoc_link/rustdoc-link.snap
··· 1 1 --- 2 2 source: crates/mdbookkit/tests/rustdoc_link.rs 3 + assertion_line: 31 3 4 expression: output 4 5 --- 5 6 # mdbook-rustdoc-link ··· 34 35 </figure> 35 36 36 37 `mdbook-rustdoc-link` is an mdBook [preprocessor]. Using rust-analyzer, it converts type 37 - names, module paths, etc. into links to online crate docs. No more finding and pasting 38 - URLs by hand. 38 + names, module paths, and so on, into links to online crate docs. No more finding and 39 + pasting URLs by hand. 39 40 40 41 <figure> 41 42
+2 -2
docs/book.toml
··· 37 37 after = ["links"] 38 38 cache-dir = "build" 39 39 cargo-features = ["clap/unstable-doc"] 40 - command = "cargo run --package mdbookkit --bin mdbook-rustdoc-link --all-features --release" 40 + command = "cargo run --package mdbookkit --bin mdbook-rustdoc-link --all-features" 41 41 manifest-dir = "." 42 42 rust-analyzer = "cargo run --package util-rust-analyzer --all-features -- analyzer" 43 43 ··· 45 45 after = ["rustdoc-link"] 46 46 always-link = [".rs"] 47 47 book-url = "https://tonywu6.github.io/mdbookkit/" 48 - command = "cargo run --package mdbookkit --bin mdbook-link-forever --all-features --release" 48 + command = "cargo run --package mdbookkit --bin mdbook-link-forever --all-features" 49 49 50 50 [preprocessor.rust-analyzer-version] 51 51 after = ["rustdoc-link"]
+2 -2
docs/src/rustdoc-link.md
··· 30 30 </figure> 31 31 32 32 `mdbook-rustdoc-link` is an mdBook [preprocessor]. Using rust-analyzer, it converts type 33 - names, module paths, etc. into links to online crate docs. No more finding and pasting 34 - URLs by hand. 33 + names, module paths, and so on, into links to online crate docs. No more finding and 34 + pasting URLs by hand. 35 35 36 36 <figure> 37 37