syia-mcp-utils
Version:
Global utility functions for MCP server
20 lines (19 loc) • 698 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.markdownToHtmlLink = markdownToHtmlLink;
/**
* Converts a markdown link to an HTML link
* @param text The markdown text containing links
* @returns The text with markdown links converted to HTML links
*/
function markdownToHtmlLink(text) {
// Regex to match markdown links [text](url)
const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
// Replace markdown links with HTML links
return text.replace(markdownLinkRegex, (_, linkText, url) => {
return `<a href="${url}" target="_blank" rel="noopener noreferrer">${linkText}</a>`;
});
}
exports.default = {
markdownToHtmlLink
};