Skip to main content
Glama
comments-and.md1.52 kB
## Comments: `{> "..." <}` and `{>> "..." <<}` Since Rust's tokenizer strips whitespace before macros see them, use string literals to preserve exact spacing in comments: ### Block Comments Use `{> "comment" <}` for block comments: Rust ``` let code = ts_template! {     {> "This is a block comment" <}     const x = 42; }; ``` **Generates:** TypeScript ``` /* This is a block comment */ const x = 42; ``` ### Doc Comments (JSDoc) Use `{>> "doc" <<}` for JSDoc comments: Rust ``` let code = ts_template! {     {>> "@param {string} name - The user's name" <<}     {>> "@returns {string} A greeting message" <<}     function greet(name: string): string {         return "Hello, " + name;     } }; ``` **Generates:** TypeScript ``` /** @param {string} name - The user's name */ /** @returns {string} A greeting message */ function greet(name: string): string {     return "Hello, " + name; } ``` ### Comments with Interpolation Use `format!()` or similar to build dynamic comment strings: Rust ``` let param_name = "userId"; let param_type = "number"; let comment = format!("@param {{{}}} {} - The user ID", param_type, param_name); let code = ts_template! {     {>> @{comment} <<}     function getUser(userId: number) {} }; ``` **Generates:** TypeScript ``` /** @param {number} userId - The user ID */ function getUser(userId: number) {} ```

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/macroforge-ts/mcp-server'

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