Skip to content

Node: Code

Qz edited this page Jul 15, 2025 · 2 revisions
interface Code extends Literal {
  type: "code";
  value: string;
  data?: CodeData;
  position?: Position;
}

Description

Telegram monowidth string. Represents code entities in Telegram messages.

Example

Code screenshot.

Input

{
  "text": "This is a monowidth string.",
  "entities": [
    {
      "offset": 0,
      "length": 27,
      "type": "code"
    }
  ]
}

Output

{
  type: "code",
  value: "This is a monowidth string.",
  position: {
    start: {
      line: 1,
      column: 1,
      offset: 0
    },
    end: {
      line: 1,
      column: 28,
      offset: 27
    }
  }
}

Reference

Clone this wiki locally