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>
This commit is contained in:
codegen-sh[bot] authored and GitHub committed 2025-11-08 14:27:45 -05:00
1 parent f683822852
commit 99167bbdd6
1 file changed
+9 -1
+9 -1
View File
@@ -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() {