---
metadata:
  - name: generator
    content: Diplodoc Platform v5.70.0
alternate:
  - https://divkit.tech/docs/en/concepts/extensions/markdown.md
  - https://divkit.tech/docs/ru/concepts/extensions/markdown.md
  - href: https://divkit.tech/docs/en/concepts/extensions/markdown.md
    type: text/markdown
    title: Markdown version
  - href: https://divkit.tech/docs/en/llms.txt?revision=r22102947
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://divkit.tech/docs/en/llms.txt?revision=r22102947

# Markdown in text

The `markdown` extension displays the value of the `text` property of the [text](https://divkit.tech/docs/en/concepts/divs/2/div-text.md) element as text with Markdown markup.

```json translate=no
{
  "type": "text",
  "text": "# Heading\n\nText with **bold** and *italic* emphasis.",
  "extensions": [
    {
      "id": "markdown"
    }
  ]
}
```

The extension has no parameters.

## How it works {#behavior}

- The extension is applied only to the `text` element.
- The set of supported Markdown constructs depends on the platform:

    - Android: Basic CommonMark syntax. Additional constructs are added with plugins of the [Markwon](https://github.com/noties/Markwon) library.
    - iOS: Headings, bold, italic, and strikethrough text, links, inline code, bulleted and numbered lists, block quotes.
    - Web: Defined by the function that converts Markdown to HTML and is passed by the application.

## Connection {#connect}

{% list tabs %}

- Android

  build.gradle

  ```groovy translate=no
  dependencies {
      implementation "com.yandex.div:div-markdown:${versions.divkit}"
  }
  ```

  In the code:

  ```kotlin translate=no
  val divConfiguration = DivConfiguration.Builder(imageLoader)
      .extension(DivMarkdownExtensionHandler(context))
      .build()
  ```

  You can pass a list of Markwon plugins as the second constructor parameter.

- iOS

  The handler is located in the `DivKitMarkdownExtension` module:

  ```swift translate=no
  import DivKitMarkdownExtension

  DivKitComponents(
    ...
    extensionHandlers: [
      MarkdownExtensionHandler()
    ]
  )
  ```

- Web

  DivKit doesn't contain a Markdown parsing library. Pass a function that converts Markdown to HTML to `markdownExtensionBuilder`:

  ```js translate=no
  import { markdownExtensionBuilder } from '@divkitframework/divkit/client';
  import markdownit from 'markdown-it';

  const md = markdownit();
  const map = new Map();

  map.set('markdown', markdownExtensionBuilder(str => md.render(str)));

  render({
      id: 'test',
      target: element,
      json: {},
      extensions: map
  });
  ```

  As the second argument, you can pass an object with the `cssClass` field: a CSS class that is added to the container with the conversion result.

{% endlist %}

<!-- source: en/_includes/index/troubleshooting.md -->
## Learn more {#troubleshooting}

You can discuss topics of interest in the DivKit user community in Telegram: [https://t.me/divkit_community_en](https://t.me/divkit_community_en).



[DivKit Repository](https://github.com/divkit/divkit)
<!-- endsource: en/_includes/index/troubleshooting.md -->
