Repository navigation
Resolve images against the repository content root - #10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更理由
画像解決の信頼境界が Markdown ファイルの親ディレクトリだったため、Azure DevOps Wiki の標準構成で画像が描画できなかった。
design/platform.mdから../.attachments/architecture.pngを参照すると境界外になり、placeholder に落ちていた。Azure DevOps は相対パスに加えてルート起点の絶対パスもサポートしている。変更内容
.gitを持つ祖先。ディレクトリでもファイルでもよいので worktree / submodule も可)へ広げた。git 管理外なら従来どおり文書の親が境界。/はフレーバーに関係なく content root 起点として解決する。ファイルシステムの絶対パスとしては扱わない。starts_with(boundary)なので、root を越える../も root 外を指す symlink も同じ経路で弾かれる。.attachmentsをマーカーに使わない理由: 1 リポジトリに複数あり得て、最も近いものがページの参照先とは限らない。mdvu a.mdのようにパスにディレクトリ成分が無いときbase_dirが空文字になり canonicalize に失敗して画像が一切解決されなかった不具合を直した(空文字 →.)。--rootなどのフラグは追加していない。Azure の=500x250サイズ指定は今回のスコープ外。影響範囲
src/image/mod.rs—content_root()を追加、confined()に境界の概念を導入src/layout/inline.rs—InlineContext.content_rootsrc/layout/document.rs/src/main.rs— 受け渡し。root の検出は起動時 1 回(パスにしか依存しないので--watchの reload でも変わらない)README.mdの Images 節・制限事項、.claude/rules/rendering.md/Users/...)はこれまで「境界内なら通る」だったが、今後は content root 起点として再解釈されるため事実上通らなくなる確認手順
cargo test --test render --test cli→ 53 + 24 passedcargo test --bin mdvu image::→ 40 passed(content root の unit test を追加)cargo clippy --all-targets --all-features -- -D warnings/cargo fmt --check→ cleancargo test --all-featuresはpager::watchの 2 件が sandbox の FSEvents 制約で落ちる(.claude/rules/runtime.mdに記録済みの既知事象。CI で検証)tests/cli.rsのa_page_reads_attachments_from_the_repository_rootで、一時 Wiki の相対 / ルート相対の 2 枚が kitty placement になり、root 外の 1 枚が placeholder のままであることを検証.gitを持つ一時 Wiki を作ってmdvu design/platform.mdを実行し、2 枚描画・root 外は placeholder を確認済み