Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added

- Diff view for text files: side-by-side / unified layouts, word-level highlights, change navigation, whitespace-insensitive comparison, expandable context, jump-to-line, and patch copy / download. Secret Safe mode masks both sides.
- Live change review: a chip shows `+N −M` when an open file changes on disk, opening a diff against the version first opened in the session (`D` shortcut).
- Git history: compare a file with `HEAD` or recent commits (`/api/git/log`, `/api/git/show`), Git change badges in the file tree and a "Git: 変更のみ" filter (`/api/git/status`).
- Link check: broken relative links, images, reference definitions and wiki links across Markdown documents (`/api/links/check`), shown per document in the TOC panel and as a folder report.

## 1.9.0 - 2026-07-30

### Changed
Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ No linter/formatter configured; TypeScript strict mode is the quality gate.
- `GET /api/search?q=` — full-text grep across served directory
- `GET /api/watch` — SSE stream; Chokidar broadcasts file changes to all connected clients
- `GET /api/custom-css` — loads `.docview.css` from the served directory
- `GET /api/git/status` / `GET /api/git/log?path=` / `GET /api/git/show?path=&rev=` — read-only Git history (execFile, validated rev, timeout); `git:false` outside a repo
- `GET /api/links/check?path=` — broken relative links in Markdown (resolved like the viewer), scoped to a folder/file

**Frontend (`src/`)** — Vanilla TypeScript SPA, no framework. Each UI concern is a separate module:
- `main.ts` — app shell, routing (`#file=path`), file fetching, scroll memory, code-block copy buttons
- `markdown.ts` — markdown-it pipeline with GFM, footnotes, KaTeX, Mermaid, DOMPurify sanitization, GitHub Alerts
- `filetree.ts` / `tabs.ts` / `toc.ts` / `search.ts` / `find-bar.ts` — sidebar, tabs, TOC, search modal, vim-style find
- `json-tree.ts` / `yaml-tree.ts` / `csv-viewer.ts` — structured data viewers (tree views, tables)
- `theme.ts` — light/dark toggle with localStorage persistence
- `text-diff.ts` (pure Myers line diff + intraline + unified patch, unit-tested from `tests/text-diff.test.mjs`) / `diff-view.ts` (diff modal: files, Git revisions, in-session snapshots) / `link-report.ts` (link check modal)

**CLI (`bin/mdv.mjs`)** — Parses args, imports server, auto-opens browser.

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ If the browser doesn't open, copy `http://localhost:4000` into any browser — i
- **Text size** — adjust document text from 50% to 200% in 10% steps; preference is persisted
- **Table of contents** — auto-generated TOC sidebar from heading structure
- **Search** — full-text search across all files in the directory
- **Diff view** — compare any two text files side by side or unified, with word-level highlights, change navigation (`n` / `p`), whitespace-insensitive mode, expandable context, click-through to the line, and patch copy / `.patch` download. Right-click a file → *表示中の「…」と比較* or *比較元として選択*
- **Live change review** — when an open file is edited by another tool, a *変更あり +N −M* chip appears next to the breadcrumb; click it (or press `D`) to see exactly what changed since you opened it, and *確認済みにする* to reset the baseline
- **Git history** — for files in a Git repository, compare the working copy against `HEAD` or any of the last 30 commits that touched the file. The file tree marks uncommitted changes (`M` / `A` / `U`) and the filter menu adds *Git: 変更のみ*. Read-only: DocView only runs `git status`, `git log` and `git show`
- **Link check** — finds relative links, images, reference definitions and `[[wiki links]]` in Markdown whose target does not exist (resolved exactly as the viewer resolves them), with same-name files suggested as fixes. Per-document results appear in the TOC panel; right-click a folder (or the root name) for a report you can copy as a Markdown checklist. The report re-checks live as files change
- **Tabs** — open multiple files as tabs within a single session

## Supported Formats
Expand Down Expand Up @@ -142,6 +146,9 @@ docview ./docs --no-open
| `Cmd/Ctrl + E` | Toggle table of contents |
| `Cmd/Ctrl + Shift + E` | Toggle theme (dark / light) |
| `Cmd/Ctrl + Shift + S` | Present as slides (Marp deck for `marp: true` files) |
| `D` | Diff the current file (changes since opened, else Git `HEAD`) |
| `n` / `p` (`j` / `k`) | Next / previous change in the diff view |
| `u` | Toggle side-by-side / unified diff |
| `Cmd/Ctrl + =` / `-` / `0` | Increase / decrease / reset document text size |
| `?` | Show keyboard shortcut help |
| `↑` / `↓` | Navigate file list / search results |
Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h1 class="app-title">
<span class="app-title-text">DocView</span>
</h1>
<nav id="breadcrumb" class="breadcrumb"></nav>
<button id="btn-live-changes" class="live-change-chip" type="button" hidden title="開いてから変更された箇所を表示 (D)"></button>
</div>
<div class="toolbar-right">
<button id="btn-sidebar" class="toolbar-btn" title="Toggle Sidebar (Cmd+B)">
Expand All @@ -45,6 +46,9 @@ <h1 class="app-title">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
<span class="btn-label">URL</span>
</button>
<button id="btn-diff" class="toolbar-btn" title="Diff / 変更履歴 (D)" aria-label="Show diff for the current file">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="6" cy="6" r="2.5"/><circle cx="18" cy="18" r="2.5"/><path d="M6 8.5V13a5 5 0 0 0 5 5h4.5"/><path d="M18 15.5V11a5 5 0 0 0-5-5H8.5"/></svg>
</button>
<button id="btn-print" class="toolbar-btn" title="Print / PDF">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 6 2 18 2 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>
</button>
Expand Down
Loading
Loading