Skip to main content
Glama
installIntlayerMarkdown.ts1.26 kB
import { type App, inject, type VNodeChild } from 'vue'; export const INTLAYER_MARKDOWN_SYMBOL = Symbol('intlayerMarkdown'); type RenderMarkdownFunction = (markdown: string) => VNodeChild; /** * Singleton instance */ let instance: IntlayerMarkdownProvider | null = null; export type IntlayerMarkdownProvider = { renderMarkdown: RenderMarkdownFunction; }; /** * Create and return a single IntlayerMarkdownProvider instance */ export const createIntlayerMarkdownClient = ( renderMarkdown: RenderMarkdownFunction ): IntlayerMarkdownProvider => { if (instance) return instance; instance = { renderMarkdown, }; return instance; }; /** * Helper to install the IntlayerMarkdown provider into the app */ export const installIntlayerMarkdown = ( app: App, renderMarkdown: RenderMarkdownFunction ) => { const client = createIntlayerMarkdownClient(renderMarkdown); app.provide(INTLAYER_MARKDOWN_SYMBOL, client); }; export const useMarkdown = () => { const renderMarkdown = inject<IntlayerMarkdownProvider>( INTLAYER_MARKDOWN_SYMBOL, { renderMarkdown: (markdown) => markdown, } ); if (!renderMarkdown) { throw new Error('useMarkdown must be used within a MarkdownProvider'); } return renderMarkdown; };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server