Skip to main content

getEscapedText

Summary

Escapes text for safe markdown output

Signature

protected getEscapedText(text: string): string;

Parameters

text

Type:string Raw text to escape

Returns

Type:string Escapes text for safe markdown output

Remarks

The escaping order is critical: 1. Backslashes first - Prevents double-escaping (e.g., \* becoming \\*) 2. Markdown syntax - Escapes *, #, [, ], _, |, ``,~ 3. **Triple hyphens** - Prevents horizontal rules (---) 4. **HTML entities** - Escapes &, ``, for safe HTML rendering This ensures that literal text like *bold* appears as-is instead of rendering as markdown formatting.