+ {{ announcement }} +
+ ++ {{ n('text', '%n change', '%n changes', activeEdits.length) }} +
+ ++ {{ + t('text', 'No rendered differences — Markdown syntax differs.') + }} +
++ {{ t('text', 'No differences.') }} +
++ {{ + t( + 'text', + 'Source compares literal Markdown, so its change groups can differ from rendered changes.', + ) + }} +
++ {{ + t( + 'text', + 'Line endings changed: {before} → {after}', + model.lineEndingChange, + ) + }} +
+ ++ {{ + t( + 'text', + 'Additional unchanged lines are hidden to keep the comparison responsive.', + ) + }} +
+{{ t('text', 'Complete Markdown source is shown because a detailed comparison is unavailable.') }}
++ {{ t('text', 'Source preview was truncated to the display limit.') }} +
+{{ before.text }}
+ {{ after.text }}
+ \n${escapeHtml(content)}`
+}
+
/**
*
* @param editor to apply methods to
@@ -29,12 +35,9 @@ export function useEditorMethods(editor: Editor) {
) => void = (content, { addToHistory = true } = {}) => {
const hasMarkdownContent
= editor.extensionManager.extensions.includes(Markdown)
- const html = hasMarkdownContent
- ? markdownit.render(content) + ''
- : `\n${escapeHtml(content)}`
editor
.chain()
- .setContent(html, { emitUpdate: addToHistory })
+ .setContent(renderEditorContent(content, hasMarkdownContent), { emitUpdate: addToHistory })
.command(({ tr }) => {
tr.setMeta('addToHistory', addToHistory)
return true
diff --git a/src/createMarkdownContentComparison.ts b/src/createMarkdownContentComparison.ts
new file mode 100644
index 00000000000..c525e532cd9
--- /dev/null
+++ b/src/createMarkdownContentComparison.ts
@@ -0,0 +1,123 @@
+/**
+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { createApp } from 'vue'
+import MarkdownSourceFallback from './components/MarkdownSourceFallback.vue'
+import { OPEN_LINK_HANDLER } from './composables/useOpenLinkHandler.ts'
+import { openLink } from './helpers/links.js'
+
+export interface MarkdownContentComparisonOptions {
+ el: HTMLElement
+ beforeContent: string
+ afterContent: string
+ fileId?: number
+ filePath?: string
+ shareToken?: string
+ noLazyImages?: boolean
+ openLinkHandler?: (href: string) => void
+ onLoaded?: () => void | Promisecontent
content
content