Repository navigation
feat: Render HTML files in a sandboxed iframe - #42
Merged
Merged
Conversation
## 変更内容 `.html` と `.htm` のファイルページは、描画した結果を sandbox 付きの iframe(`srcdoc`)で本文に出し、ハイライトしたソースを同じページの `<details>` に置く。sandbox は `allow-scripts` だけで、`allow-same-origin` は付けない。iframe の高さは画面の 80% に固定し、中でスクロールする。メタ情報と Copy file はコードのページと同じ。`MAX_BYTES` 超とバイナリの扱いは変えない。 ## 保証 - `.html` / `.htm` を srcdoc の iframe で出し、sandbox は allow-scripts を含み allow-same-origin を含まない → tests/test_build.py::test_html_file_page_renders_in_sandboxed_iframe - ソースも `<details>` で同じページに出す → 同上 - メタ情報と Copy file → 同上 - MAX_BYTES 超は iframe を出さず Too large to display → 同上 - 維持: `.svg` はコード表示(同上・test_images_are_copied_and_shown)、ナビゲーション(test_file_page_navigation)、--incremental(test_incremental_build_matches_full_build)、Markdown(既存テスト) ## 静的確認結果 - `nix develop -c pytest -q`: 89 passed - git diff --name-only --cached: README.en.md / README.md / codeview/build.py / codeview/render.py / codeview/style.py / docs/guarantees.md / tests/test_build.py ## 検証手順 実際の資料を codeview-local で開き、描画・iframe の高さ・ソースの切り替えを見る(手元の画面で確認済み)。
確認者の指摘を受け、Copy file が写すソースの中身と、バイナリの .html に iframe を出さないことをテストで固定する。
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.
変更内容
.htmlと.htmのファイルページでは、描画した結果を sandbox 付きの iframe(srcdoc)で本文に出し、ハイライトしたソースを同じページの<details>に置く。sandbox はallow-scriptsだけで、allow-same-originは付けない。iframe の高さは画面の 80% に固定し、中でスクロールする。メタ情報と Copy file(写すのはソース)はコードのページと同じ。MAX_BYTES超とバイナリの扱いは変えない。README(日本語・英語)と保証台帳 §1 を更新した。UTF-8 でない HTML は文字化けする(コード表示と同じ読み方)。user と相談して今回は見送った。
保証
.html/.htmを srcdoc の iframe で出し、sandbox は allow-scripts を含み allow-same-origin を含まない →tests/test_build.py::test_html_file_page_renders_in_sandboxed_iframe<details>で同じページに出し、Copy file はそのソースを写す → 同上.svgのコード表示(同上・test_images_are_copied_and_shown)、ナビゲーション(test_file_page_navigation)、--incremental(test_incremental_build_matches_full_build)静的確認結果
nix develop -c pytest -q: 89 passed確認者の判定
.htmlの iframe・srcdoc・sandbox・ソース.htmも同じ.svgに iframe が無い--incrementalの既存テストが通る保証(Copy file の中身・バイナリを含む)もすべて合。
手戻り
.htmlに iframe を出さないことをテストで固定していなかったので、テストを足した