From 99167bbdd600c677cbb74353a52bddfd8d83f1c6 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Sat, 8 Nov 2025 14:27:45 -0500 Subject: [PATCH] Serialize `document` and `collection` mentions as regular links (#10595) * Serialize document and collection mentions as regular links - Update toMarkdown method in Mention.tsx to use regular markdown links for documents and collections - Documents now serialize as [label](URL/doc/modelId) instead of @[label](mention://id/document/modelId) - Collections now serialize as [label](URL/collection/modelId) instead of @[label](mention://id/collection/modelId) - User mentions and other types retain the existing mention:// format for backward compatibility - Improves portability of exported markdown and aligns with standard markdown link format Fixes #10544 * Use relative URLs for document and collection mentions - Remove domain from mention links to use relative paths - Documents now serialize as [label](/doc/modelId) - Collections now serialize as [label](/collection/modelId) - Makes exported markdown more portable across different domains --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> --- shared/editor/nodes/Mention.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shared/editor/nodes/Mention.tsx b/shared/editor/nodes/Mention.tsx index d10d8b93a8..8952901e10 100644 --- a/shared/editor/nodes/Mention.tsx +++ b/shared/editor/nodes/Mention.tsx @@ -309,7 +309,15 @@ export default class Mention extends Node { const label = node.attrs.label; const id = node.attrs.id; - state.write(`@[${label}](mention://${id}/${mType}/${mId})`); + // Use regular links for document and collection mentions + if (mType === MentionType.Document) { + state.write(`[${label}](/doc/${mId})`); + } else if (mType === MentionType.Collection) { + state.write(`[${label}](/collection/${mId})`); + } else { + // Keep the existing mention:// format for other types (user, group, issue, pull_request, url) + state.write(`@[${label}](mention://${id}/${mType}/${mId})`); + } } parseMarkdown() {