/** * Markdown formatting utilities. */ import type { Language } from "../types/index.js"; import type { ProjectSearchEntry, ProjectHeader, PublicationDetails } from "../types/api.js"; /** * Defensively escapes user input for embedding into inline Markdown *prose* * (i.e. plain text in list items, paragraphs — NOT inside a code span). * * Backslashes must be escaped before backticks: otherwise input like `` \` `` * would become `` \\` ``, which Markdown reads as a literal `\` followed by an * un-escaped backtick. Newlines are collapsed to spaces. * * For embedding inside a code span, use {@link formatInlineCode} instead — * CommonMark treats backslashes as literal inside code spans, so backslash * escaping does nothing there. */ export declare function escapeInlineCode(value: string): string; /** * Wraps user input in a CommonMark-safe inline code span. * * Per CommonMark §6.1, a code span is delimited by backtick runs of equal * length, and a backtick run inside the content cannot match the fence. We * pick a fence one longer than the longest run of backticks in `value`, and * pad with a single space if the content starts or ends with a backtick (the * pad is stripped by the parser when the content has any non-space char, so * the rendering is unaffected). * * Newlines are collapsed to spaces; the renderer would do this anyway, but * doing it here keeps tool output predictable when concatenated into * multi-line blocks. * * Examples: * formatInlineCode("foo") → "`foo`" * formatInlineCode("a`b") → "``a`b``" * formatInlineCode("`x`") → "`` `x` ``" * formatInlineCode("a``b") → "```a``b```" */ export declare function formatInlineCode(value: string): string; /** * Builds the simap.ch URL for a project. */ export declare function buildSimapUrl(projectId: string, lang: Language): string; /** * Formats a project search entry for display. */ export declare function formatProject(project: ProjectSearchEntry, lang: Language): string; /** * Formats project header information. */ export declare function formatProjectHeader(header: ProjectHeader, lang: Language, projectId?: string): string; /** * Formats publication details. * * Sections are rendered only when the underlying data is present. The response * shape varies by publication `type` (tender / award / ...) — no one section * is guaranteed. */ export declare function formatPublicationDetails(details: PublicationDetails, lang: Language): string; /** * Creates a markdown header with optional count. */ export declare function formatHeader(title: string, count?: number): string;