> ## Documentation Index
> Fetch the complete documentation index at: https://docs.somark.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Using SoMark in Dify

> Add SoMark Document Parser to your Dify workflows via the plugin marketplace

## Install and Configure the Plugin

<Steps>
  <Step title="Install the plugin">
    Log in to your Dify platform, navigate to **Tools** → **Plugin Marketplace**, search for **SoMark**, and add the plugin.
  </Step>

  <Step title="Configure plugin settings">
    After installation, open the plugin configuration page:

    * **Base URL**: For SoMark API, fill in `https://somark.tech/api/v1`; for self-hosted deployment, fill in your local Base URL.
    * **API Key**: Required for SoMark API; leave blank for self-hosted deployment.

    <Note>
      No API Key yet? [Go to the SoMark workbench to claim free quota](https://somark.tech/workbench/purchase).
    </Note>

    <Warning>
      The Dify plugin runtime must be able to access the configured **Base URL**. Check your network, proxy, and DNS settings. Do not append a specific endpoint path to **Base URL**; the plugin will call the corresponding endpoint automatically.
    </Warning>
  </Step>

  <Step title="Save">
    Click **Save** — the plugin is now ready to use in workflows.

    <img src="https://mintcdn.com/soulcode-aa7e5a93/mqnfzKMhfEvy3I3O/images/dify-SoMark%E5%B7%A5%E5%85%B7%E6%8E%88%E6%9D%83%E9%85%8D%E7%BD%AE.png?fit=max&auto=format&n=mqnfzKMhfEvy3I3O&q=85&s=18f3fc7b10bcc5ff69df75165d9a3e6b" alt="dify-SoMark工具授权配置" width="1232" height="972" data-path="images/dify-SoMark工具授权配置.png" />
  </Step>
</Steps>

***

## Using SoMark in a Workflow

<Steps>
  <Step title="Add the SoMark Document Parser tool node">
    In the Dify workflow editor, click **+** to add a new node, choose **Tool**, then find and add the **SoMark > SoMark Document Parser** node.

    <img src="https://mintcdn.com/soulcode-aa7e5a93/mqnfzKMhfEvy3I3O/images/dify-%E6%B7%BB%E5%8A%A0SoMark%E5%B7%A5%E5%85%B7%E8%8A%82%E7%82%B9.png?fit=max&auto=format&n=mqnfzKMhfEvy3I3O&q=85&s=15da0b5bca2be70c456a281c7483e900" alt="Add SoMark tool node in Dify" width="1714" height="922" data-path="images/dify-添加SoMark工具节点.png" />
  </Step>

  <Step title="Configure input variables">
    Click the variable icon **`{x}`** in the **File** input field and select the file variable provided by an upstream node, such as `sys.files` from your Start node.
    You can also configure optional parameters (for example **Output Formats**, **Image Format**, **Table Format**) as needed. If left empty, the default values are used. See **Input Parameters** below for details.
    **Base URL** and **API Key** are injected automatically from the plugin configuration. You do not need to enter them in the node.

    <img src="https://mintcdn.com/soulcode-aa7e5a93/rxyqA7fo56mP0TxQ/images/dify-%E9%85%8D%E7%BD%AE%E8%BE%93%E5%85%A5%E5%8F%98%E9%87%8F.png?fit=max&auto=format&n=rxyqA7fo56mP0TxQ&q=85&s=e508a26c4a6cd4c7e6159fa6332f3f96" alt="Configure input variable in Dify" width="2428" height="1278" data-path="images/dify-配置输入变量.png" />
  </Step>

  <Step title="Reference outputs in downstream nodes">
    Once the node executes, its output variables are available to all downstream nodes (LLM, text splitter, code node, etc.). Click **`{x}`** in any downstream node's input field to select the SoMark node's output variables.
  </Step>
</Steps>

***

## Parameters and Outputs

### Input Parameters

| Parameter                           | Type          | Required | Description                                                                                                                                                                      |
| :---------------------------------- | :------------ | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `File`                              | File          | ✅        | Supported files: PDF, PNG, JPG, JPEG, BMP, TIFF, JP2, DIB, PPM, PGM, PBM, GIF, HEIC, HEIF, WEBP, XPM, TGA, DDS, XBM, DOC, DOCX, PPT, PPTX. Max 200 MB / 300 pages.               |
| `Output Formats`                    | Single-select | ❌        | Select the output format. Supported options: `Markdown`, `JSON`, `Both "Markdown" and "JSON"`. Default: `Both "Markdown" and "JSON"`.                                            |
| `Image Format`                      | Single-select | ❌        | Image output format. Supported options: `URL`, `Base64`, `None`. Default: `URL`.                                                                                                 |
| `Formula Format`                    | Single-select | ❌        | Formula output format. Supported options: `LaTeX`, `MathML`, `ASCII`. Default: `LaTeX`.                                                                                          |
| `Table Format`                      | Single-select | ❌        | Table output format. Supported options: `HTML`, `Markdown`, `Image`. Default: `HTML`. In Markdown mode, merged cells are expanded into individual cells with duplicated content. |
| `Chemical Structure Formula Format` | Single-select | ❌        | Chemical structure output format. Supported options: `Image`. Default: `Image`.                                                                                                  |
| `Enable Text Cross Page`            | True / False  | ❌        | Merge text that spans across pages into a continuous paragraph. Default: `False`.                                                                                                |
| `Enable Table Cross Page`           | True / False  | ❌        | Merge tables that span across pages into a continuous table. Default: `False`.                                                                                                   |
| `Enable Title Level Recognition`    | True / False  | ❌        | Recognize heading hierarchy such as H1/H2/H3. Default: `False`.                                                                                                                  |
| `Enable Inline Image`               | True / False  | ❌        | Return images embedded in text paragraphs. Default: `False`.                                                                                                                     |
| `Enable Table Image`                | True / False  | ❌        | Return images embedded in table cells. Default: `True`.                                                                                                                          |
| `Enable Image Understanding`        | True / False  | ❌        | Perform semantic understanding and structured description for images in the document. Default: `True`.                                                                           |
| `Keep Header Footer`                | True / False  | ❌        | Keep page headers and footers instead of filtering them out. Default: `False`.                                                                                                   |

### Output Variables

| Variable   | Description                                                                                                                                                                                  |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `markdown` | Parsed document content in Markdown format, preserving the original layout including headings, tables, lists, equations, and images                                                          |
| `json_str` | Parsed result as a JSON string, containing structured data such as text blocks, tables, equations, images, bounding boxes, and page numbers. Parse it in a code node for advanced processing |
| `text`     | Dify built-in variable. This plugin does not populate it                                                                                                                                     |
| `files`    | Dify built-in variable. This plugin does not populate it                                                                                                                                     |
