@hakulex/diff-core
v0.4.1
Published
Compare two hakulex documents: aligned blocks, character marks and change counts
Maintainers
Readme
@hakulex/diff-core
比對兩份文件的核心邏輯,例如算出字數和區塊的變更統計,不含畫面。
hakulex 的一部分:給 Vue 3 的富文本編輯器,建立在 Lexical 上。這個套件的說明和可以操作的範例在 hakulex.dev/packages/diff-core。
安裝
pnpm add @hakulex/diff-core lexical使用
範例裡的 ./documents 是你自己的文件 JSON,也就是編輯器的 v-model 存下來的內容。
<script setup lang="ts">
import { computeDeltaStats, formatDeltaStats } from '@hakulex/diff-core'
import { article, revised } from './documents'
const stats = computeDeltaStats(article, revised)
</script>
<template>
<pre>{{ formatDeltaStats(stats) }}</pre>
</template>