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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Feature request / 功能建議
description: Suggest an idea for Diff. 提出新功能或改善建議。
description: Suggest an idea for Text Diff. 提出新功能或改善建議。
labels: [enhancement]
body:
- type: textarea
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

## English

Thank you for helping improve Diff! Bug reports, ideas, translations, and pull requests are all welcome.
Thank you for helping improve Text Diff! Bug reports, ideas, translations, and pull requests are all welcome.

### Reporting issues

- Use the issue templates for [bug reports](https://github.com/KageRyo/diff/issues/new?template=bug_report.yml) and [feature requests](https://github.com/KageRyo/diff/issues/new?template=feature_request.yml).
- Use the issue templates for [bug reports](https://github.com/KageRyo/text-diff/issues/new?template=bug_report.yml) and [feature requests](https://github.com/KageRyo/text-diff/issues/new?template=feature_request.yml).
- For counting or diff problems, include a minimal sample text, the options you enabled, and the result you expected.
- Do not paste private or sensitive text.

Expand Down Expand Up @@ -52,11 +52,11 @@ feat(diff): add a word-level highlight option

## 正體中文

感謝你協助改善 Diff!歡迎回報問題、提出想法、協助翻譯或送出 pull request。
感謝你協助改善 Text Diff!歡迎回報問題、提出想法、協助翻譯或送出 pull request。

### 回報問題

- 請使用 [Bug 回報](https://github.com/KageRyo/diff/issues/new?template=bug_report.yml) 與 [功能建議](https://github.com/KageRyo/diff/issues/new?template=feature_request.yml) 範本。
- 請使用 [Bug 回報](https://github.com/KageRyo/text-diff/issues/new?template=bug_report.yml) 與 [功能建議](https://github.com/KageRyo/text-diff/issues/new?template=feature_request.yml) 範本。
- 統計或比對結果有誤時,請附上最小的範例文字、勾選的選項,以及你預期的結果。
- 請勿貼上私人或敏感內容。

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Diff
# Text Diff

[正體中文](README_TW.md) · [Demo](https://kageryo.github.io/diff/)
[正體中文](README_TW.md) · [Demo](https://kageryo.github.io/text-diff/)

Compare two texts side by side with git-style highlighting, and count words, characters, Chinese characters, English words, digits, symbols, and whitespace as you type. Everything runs in your browser: your text is never uploaded or stored.

[![Release](https://img.shields.io/github/v/release/KageRyo/diff)](https://github.com/KageRyo/diff/releases)
[![Release](https://img.shields.io/github/v/release/KageRyo/text-diff)](https://github.com/KageRyo/text-diff/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Tocas UI](https://img.shields.io/badge/Tocas_UI-5.7-1b1c1d)](https://tocas-ui.com/)
[![jsdiff](https://img.shields.io/badge/jsdiff-9.0-cb3837?logo=npm&logoColor=white)](https://github.com/kpdecker/jsdiff)
[![JavaScript](https://img.shields.io/badge/JavaScript-ES_modules-F7DF1E?logo=javascript&logoColor=black)](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules)
[![Pages](https://github.com/KageRyo/diff/actions/workflows/pages.yml/badge.svg)](https://github.com/KageRyo/diff/actions/workflows/pages.yml)
[![Pages](https://github.com/KageRyo/text-diff/actions/workflows/pages.yml/badge.svg)](https://github.com/KageRyo/text-diff/actions/workflows/pages.yml)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
[![GitHub stars](https://img.shields.io/github/stars/KageRyo/diff?style=flat)](https://github.com/KageRyo/diff/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/KageRyo/diff)](https://github.com/KageRyo/diff/commits)
[![GitHub stars](https://img.shields.io/github/stars/KageRyo/text-diff?style=flat)](https://github.com/KageRyo/text-diff/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/KageRyo/text-diff)](https://github.com/KageRyo/text-diff/commits)

[![Diff comparing two Traditional Chinese paragraphs with line and character highlights and statistics for each side](docs/images/screenshot.png)](https://kageryo.github.io/diff/)
[![Text Diff comparing two Traditional Chinese paragraphs with line and character highlights and statistics for each side](docs/images/screenshot.png)](https://kageryo.github.io/text-diff/)

## At a glance

Expand Down Expand Up @@ -52,20 +52,20 @@ Text is split into user-perceived characters (grapheme clusters), so an emoji se

## Usage

1. Open the [demo](https://kageryo.github.io/diff/).
1. Open the [demo](https://kageryo.github.io/text-diff/).
2. Paste the original text on the left and the modified text on the right.
3. Read the differences below the editors, and switch between **Split** and **Unified** views.
4. Adjust the statistics and diff options; your choices are remembered on this device.

The diff compares lines first, then highlights the characters that changed within each modified line. Lines that are too different are highlighted as a whole, and so are the remaining lines once highlighting a very large change has taken half a second. If the texts are so different that the comparison takes longer than 2 seconds, Diff shows the whole text as replaced.
The diff compares lines first, then highlights the characters that changed within each modified line. Lines that are too different are highlighted as a whole, and so are the remaining lines once highlighting a very large change has taken half a second. If the texts are so different that the comparison takes longer than 2 seconds, Text Diff shows the whole text as replaced.

## Development

You need Node.js 22 or newer. There is no build step: the page loads Tocas UI from cdnjs, and an import map in `index.html` loads jsdiff from `node_modules`, so install the dependencies before you serve the page.

```bash
git clone https://github.com/KageRyo/diff.git
cd diff
git clone https://github.com/KageRyo/text-diff.git
cd text-diff
npm install
npm start
```
Expand Down Expand Up @@ -96,7 +96,7 @@ The browser and the unit tests use the same jsdiff files from `node_modules`, so

The [Pages workflow](.github/workflows/pages.yml) runs the unit and browser tests on every push and pull request, and deploys the static files to GitHub Pages from `main`. To deploy a fork, open **Settings → Pages**, select **GitHub Actions** as the source, and push to `main`.

Diff is a static site, so you can also host it on any static web server. After `npm install`, publish `index.html`, `favicon.svg`, `css/`, `js/`, and `node_modules/diff/libesm/` together with `node_modules/diff/LICENSE`.
Text Diff is a static site, so you can also host it on any static web server. After `npm install`, publish `index.html`, `favicon.svg`, `css/`, `js/`, and `node_modules/diff/libesm/` together with `node_modules/diff/LICENSE`.

## Contributing

Expand Down
22 changes: 11 additions & 11 deletions README_TW.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Diff 文字比對與字數統計
# Text Diff 文字比對與字數統計

[English](README.md) · [Demo](https://kageryo.github.io/diff/)
[English](README.md) · [Demo](https://kageryo.github.io/text-diff/)

左右貼上兩段文字,即時以 git 風格標示差異,同時統計字數、字元數、中文字、英文單字、數字、符號與空白。所有處理都在瀏覽器中完成,文字不會上傳或保存。

[![Release](https://img.shields.io/github/v/release/KageRyo/diff)](https://github.com/KageRyo/diff/releases)
[![Release](https://img.shields.io/github/v/release/KageRyo/text-diff)](https://github.com/KageRyo/text-diff/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Tocas UI](https://img.shields.io/badge/Tocas_UI-5.7-1b1c1d)](https://tocas-ui.com/)
[![jsdiff](https://img.shields.io/badge/jsdiff-9.0-cb3837?logo=npm&logoColor=white)](https://github.com/kpdecker/jsdiff)
[![JavaScript](https://img.shields.io/badge/JavaScript-ES_modules-F7DF1E?logo=javascript&logoColor=black)](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules)
[![Pages](https://github.com/KageRyo/diff/actions/workflows/pages.yml/badge.svg)](https://github.com/KageRyo/diff/actions/workflows/pages.yml)
[![Pages](https://github.com/KageRyo/text-diff/actions/workflows/pages.yml/badge.svg)](https://github.com/KageRyo/text-diff/actions/workflows/pages.yml)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
[![GitHub stars](https://img.shields.io/github/stars/KageRyo/diff?style=flat)](https://github.com/KageRyo/diff/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/KageRyo/diff)](https://github.com/KageRyo/diff/commits)
[![GitHub stars](https://img.shields.io/github/stars/KageRyo/text-diff?style=flat)](https://github.com/KageRyo/text-diff/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/KageRyo/text-diff)](https://github.com/KageRyo/text-diff/commits)

[![Diff 比對兩段正體中文:逐行與逐字標示差異,並顯示兩側統計](docs/images/screenshot.png)](https://kageryo.github.io/diff/)
[![Text Diff 比對兩段正體中文:逐行與逐字標示差異,並顯示兩側統計](docs/images/screenshot.png)](https://kageryo.github.io/text-diff/)

## 功能概覽

Expand Down Expand Up @@ -52,7 +52,7 @@

## 使用方式

1. 開啟 [Demo](https://kageryo.github.io/diff/)。
1. 開啟 [Demo](https://kageryo.github.io/text-diff/)。
2. 左側貼上原始文字、右側貼上修改後的文字。
3. 在下方查看差異,並可切換「並排」或「合併」。
4. 依需求調整統計與比對選項,設定會保存在這台裝置上。
Expand All @@ -64,8 +64,8 @@
需要 Node.js 22 以上。本專案不需要 build:頁面從 cdnjs 載入 Tocas UI,並透過 `index.html` 的 import map 從 `node_modules` 載入 jsdiff,因此請先安裝依賴再啟動。

```bash
git clone https://github.com/KageRyo/diff.git
cd diff
git clone https://github.com/KageRyo/text-diff.git
cd text-diff
npm install
npm start
```
Expand Down Expand Up @@ -96,7 +96,7 @@ npm run screenshot # 重新產生 docs/images/screenshot.png

[Pages workflow](.github/workflows/pages.yml) 會在每次 push 與 pull request 執行單元與瀏覽器測試,並從 `main` 部署靜態檔案到 GitHub Pages。若要部署自己的 fork,請到 **Settings → Pages** 將來源設為 **GitHub Actions**,再 push 到 `main`。

Diff 是靜態網站,也可以放到任何靜態網頁伺服器:執行 `npm install` 後,發布 `index.html`、`favicon.svg`、`css/`、`js/`,以及 `node_modules/diff/libesm/` 與 `node_modules/diff/LICENSE`。
Text Diff 是靜態網站,也可以放到任何靜態網頁伺服器:執行 `npm install` 後,發布 `index.html`、`favicon.svg`、`css/`、`js/`,以及 `node_modules/diff/libesm/` 與 `node_modules/diff/LICENSE`。

## 參與貢獻

Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Diff · 文字比對與字數統計</title>
<title>Text Diff · 文字比對與字數統計</title>
<meta name="description" content="Compare two texts with git-style diffs and count words, characters, Chinese characters, letters, digits, symbols, and whitespace. Everything runs in your browser.">
<link rel="icon" href="favicon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
Expand All @@ -27,7 +27,7 @@
<!-- Header: title, language and theme toggles, GitHub link -->
<header class="app-header">
<div>
<h1 class="ts-header is-large is-heavy">Diff</h1>
<h1 class="ts-header is-large is-heavy">Text Diff</h1>
<div class="ts-text is-secondary" data-i18n="app.tagline">文字比對與字數統計</div>
</div>
<div class="ts-wrap is-compact is-middle-aligned">
Expand All @@ -37,7 +37,7 @@ <h1 class="ts-header is-large is-heavy">Diff</h1>
<button class="ts-button is-ghost is-icon" id="theme-toggle" type="button" aria-label="切換主題">
<span class="ts-icon is-circle-half-stroke-icon" aria-hidden="true"></span>
</button>
<a class="ts-button is-ghost is-icon" href="https://github.com/KageRyo/diff" target="_blank" rel="noopener noreferrer" aria-label="GitHub" title="GitHub">
<a class="ts-button is-ghost is-icon" href="https://github.com/KageRyo/text-diff" target="_blank" rel="noopener noreferrer" aria-label="GitHub" title="GitHub">
<span class="ts-icon is-github-icon" aria-hidden="true"></span>
</a>
</div>
Expand Down Expand Up @@ -132,7 +132,7 @@ <h2 class="ts-text is-bold" id="right-title" data-i18n="panel.modified">修改

<!-- Footer -->
<footer class="app-footer">
<p><a href="https://github.com/KageRyo/diff" target="_blank" rel="noopener noreferrer">KageRyo/diff</a> · MIT License</p>
<p><a href="https://github.com/KageRyo/text-diff" target="_blank" rel="noopener noreferrer">KageRyo/text-diff</a> · MIT License</p>
</footer>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion js/locales/en.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** English interface strings. Keep the keys in sync with zh-TW.js. */
export default {
'app.title': 'Diff · Text Compare & Word Count',
'app.title': 'Text Diff · Text Compare & Word Count',
'app.tagline': 'Compare texts and count words',
'theme.auto': 'Auto',
'theme.light': 'Light',
Expand Down
2 changes: 1 addition & 1 deletion js/locales/zh-TW.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** Traditional Chinese (Taiwan) interface strings. Keep the keys in sync with en.js. */
export default {
'app.title': 'Diff · 文字比對與字數統計',
'app.title': 'Text Diff · 文字比對與字數統計',
'app.tagline': '文字比對與字數統計',
'theme.auto': '自動',
'theme.light': '淺色',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "kageryo-diff",
"name": "kageryo-text-diff",
"version": "0.1.0",
"private": true,
"description": "Compare two texts with git-style diffs and count words, characters, Chinese characters, letters, digits, symbols, and whitespace in your browser.",
Expand All @@ -21,13 +21,13 @@
],
"author": "Chien-Hsun Chang",
"license": "MIT",
"homepage": "https://kageryo.github.io/diff/",
"homepage": "https://kageryo.github.io/text-diff/",
"repository": {
"type": "git",
"url": "https://github.com/KageRyo/diff.git"
"url": "https://github.com/KageRyo/text-diff.git"
},
"bugs": {
"url": "https://github.com/KageRyo/diff/issues"
"url": "https://github.com/KageRyo/text-diff/issues"
},
"engines": {
"node": ">=22"
Expand Down
2 changes: 1 addition & 1 deletion scripts/serve.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export function startServer(port = Number(process.env.PORT) || 8080) {

if (process.argv[1] === fileURLToPath(import.meta.url)) {
const server = await startServer();
console.log(`Diff is running at http://localhost:${server.address().port}`);
console.log(`Text Diff is running at http://localhost:${server.address().port}`);
}
2 changes: 1 addition & 1 deletion scripts/verify-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ try {
await page.click('#lang-toggle');
await waitForText(page, '#left-title', 'Original');
assert.equal(await page.evaluate(() => document.documentElement.lang), 'en');
assert.equal(await page.title(), 'Diff · Text Compare & Word Count');
assert.equal(await page.title(), 'Text Diff · Text Compare & Word Count');
});

await check('cycles themes', async () => {
Expand Down
Loading