Skip to content

Commit 3b65820

Browse files
committed
feat: add char level diff
1 parent a38ad14 commit 3b65820

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pages/textdiff/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
class DiffManager {
4040
static segmentText(text, mode = 'line') {
4141
if (mode === 'line') return text.split(/\n/);
42+
if (mode === 'char') return text.split("");
4243
const lang = LangDetect.detect(text);
4344
const segmenter = new Intl.Segmenter(lang, {
4445
granularity: mode === 'word' ? 'word' : 'sentence'
@@ -170,6 +171,7 @@ <h2 class="text-lg font-bold">History</h2>
170171
<option value="line">Line</option>
171172
<option value="sentence">Sentence</option>
172173
<option value="word">Word</option>
174+
<option value="char">Char</option>
173175
</select>
174176
<span id="score" class="ml-auto text-sm text-gray-400"></span>
175177
</div>

0 commit comments

Comments
 (0)