---
title: "openvibe-sdk/markdown · OpenVibe.Services"
canonical: "https://openvibe.services/docs/sdk/markdown"
updated: null
---

# openvibe-sdk/markdown · OpenVibe.Services

HTML: [openvibe-sdk/markdown · OpenVibe.Services](https://openvibe.services/docs/sdk/markdown)

# `openvibe-sdk/markdown`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

From `types/markdown.d.ts` (server only). Declarations are shown verbatim.

## type Highlight

A fenced block's highlighter: the inner HTML of its <code> (escaped by the highlighter) and the language it used.

~~~~
export type Highlight = (code: string, language: string) => { html: string; language: string };
~~~~

## interface RenderOptions

~~~~
export interface RenderOptions {
    /** Headings are demoted this many levels (1–4) so a page keeps one h1. Default 2. */
    headingShift?: number;
    /** A whole document: the heading levels it uses are numbered in order after the shift. */
    document?: boolean;
    /** Draws a fenced block with a language; without one, the code is escaped as it is. */
    highlight?: Highlight | null;
}
~~~~

## function renderMarkdown

Markdown source → HTML. Every piece of text is escaped; raw HTML in the source is shown as text.

~~~~
export declare function renderMarkdown(source: unknown, options?: RenderOptions): string;
~~~~

## function markdownToText

Markdown source → plain text for descriptions, JSON-LD and feeds, at most \`max\` characters. The caller escapes it.

~~~~
export declare function markdownToText(source: unknown, max?: number): string;
~~~~

## function escapeHtml

& < > " ' as entities.

~~~~
export declare function escapeHtml(s: unknown): string;
~~~~
