fix: style agent mentions with primary color in markdown messages
Agent @mentions in markdown use the primary accent instead of generic link color Mentions render without external URL favicons Markdown mode now matches plain text mention styling
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
export const SKILL_LINK_PREFIX = '#openchamber-skill:';
|
||||
export const AGENT_LINK_PREFIX = '#openchamber-agent:';
|
||||
|
||||
export const buildAgentMentionUrl = (name: string): string => {
|
||||
const encoded = encodeURIComponent(name);
|
||||
return `https://opencode.ai/docs/agents/#${encoded}`;
|
||||
};
|
||||
|
||||
export const buildSkillHref = (name: string): string => `${SKILL_LINK_PREFIX}${encodeURIComponent(name)}`;
|
||||
|
||||
export const buildAgentHref = (name: string): string => `${AGENT_LINK_PREFIX}${encodeURIComponent(name)}`;
|
||||
|
||||
export const parseSkillHref = (href: string | null | undefined): string | null => {
|
||||
if (!href?.startsWith(SKILL_LINK_PREFIX)) return null;
|
||||
try {
|
||||
return decodeURIComponent(href.slice(SKILL_LINK_PREFIX.length));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const parseAgentHref = (href: string | null | undefined): string | null => {
|
||||
if (!href?.startsWith(AGENT_LINK_PREFIX)) return null;
|
||||
try {
|
||||
return decodeURIComponent(href.slice(AGENT_LINK_PREFIX.length));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user