Frontend cannot to Render Inline Formulas When Using Docker Self-Host #20062

Closed
opened 2026-02-21 20:05:41 -05:00 by yindo · 1 comment
Owner

Originally created by @Dave0126 on GitHub (Oct 31, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Related Issues and PRs

Issues Description

  • When starting the containers using the docker-compose.yaml file from the main branch, the web container pulls its image as defined in ./docker/docker-compose.yaml#L692
docker inspect langgenius/dify-web:1.9.2 
[
    {
        "Id": "sha256:f09fba9988fdaf623f9dc2902190120886da321c52a1d42ad8d9dfba811c6222",
        "RepoTags": [
            "langgenius/dify-web:1.9.2"
        ],
        "RepoDigests": [
            "langgenius/dify-web@sha256:f09fba9988fdaf623f9dc2902190120886da321c52a1d42ad8d9dfba811c6222"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2025-10-29T04:33:38.387546299Z",
        "DockerVersion": "",
        "Author": "",
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 183017877,
...
  • According to PR #27070, the environment variable NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX was added to set whether inline formulas are rendered. Many thanks for this contribution.

  • However, in ./docker/docker-compose.yaml#L695-L716, this variable is not included — neither NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX nor *shared-api-worker-env is referenced. As a result, the configuration in .env does not take effect.

  • After I set the environment variable directly in the environment block as NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX: true, inline formulas still do not render correctly — see the screenshot below.
    Image

✔️ Expected Behavior

The inline formula block should be rendered.

Actual Behavior

    build:
      context: ../web
      dockerfile: Dockerfile
    image: custom-dify-web:1.9.2
Image

Suggested Actions:

  1. Please update the Docker image tagged as langgenius/dify-web:1.9.2.
  2. Include the environment variable NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX in ./docker/docker-compose.yaml#L695-L716.
Originally created by @Dave0126 on GitHub (Oct 31, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ## Related Issues and PRs - [Issue #27062](https://github.com/langgenius/dify/issues/27062) - [PR #27070](https://github.com/langgenius/dify/pull/27070) ## Issues Description - When starting the containers using the `docker-compose.yaml` file from the `main` branch, the `web` container pulls its image as defined in [./docker/docker-compose.yaml#L692](https://github.com/langgenius/dify/blob/f7f6b4a8b0029dfd57cb7f3ef1e59f7cb5f09003/docker/docker-compose.yaml#L692) ```bash docker inspect langgenius/dify-web:1.9.2 ``` ``` [ { "Id": "sha256:f09fba9988fdaf623f9dc2902190120886da321c52a1d42ad8d9dfba811c6222", "RepoTags": [ "langgenius/dify-web:1.9.2" ], "RepoDigests": [ "langgenius/dify-web@sha256:f09fba9988fdaf623f9dc2902190120886da321c52a1d42ad8d9dfba811c6222" ], "Parent": "", "Comment": "buildkit.dockerfile.v0", "Created": "2025-10-29T04:33:38.387546299Z", "DockerVersion": "", "Author": "", "Architecture": "arm64", "Os": "linux", "Size": 183017877, ... ``` - According to [PR #27070](https://github.com/langgenius/dify/issues/27062), the environment variable `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX` was added to set whether inline formulas are rendered. Many thanks for this contribution. - However, in [./docker/docker-compose.yaml#L695-L716](https://github.com/langgenius/dify/blob/f7f6b4a8b0029dfd57cb7f3ef1e59f7cb5f09003/docker/docker-compose.yaml#L695-L716), this variable is not included — neither `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX` nor `*shared-api-worker-env` is referenced. As a result, the configuration in `.env` does not take effect. - After I set the environment variable directly in the `environment` block as `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX: true`, inline formulas still do not render correctly — see the screenshot below. <img width="648" height="521" alt="Image" src="https://github.com/user-attachments/assets/bb56a9f4-4d86-49b8-b3f8-c47e4d7f23a8" /> ### ✔️ Expected Behavior The inline formula block should be rendered. ### ❌ Actual Behavior - Subsequently, I built a custom image as `custom-dify-web:1.9.2` for the web container and replaced the one defined at [docker/docker-compose.yaml#L692](https://github.com/langgenius/dify/blob/f7f6b4a8b0029dfd57cb7f3ef1e59f7cb5f09003/docker/docker-compose.yaml#L692) ``` build: context: ../web dockerfile: Dockerfile image: custom-dify-web:1.9.2 ``` <img width="648" height="521" alt="Image" src="https://github.com/user-attachments/assets/08461f79-21da-43eb-94e8-04c6088ee9a3" /> ## Suggested Actions: 1. Please update the Docker image tagged as `langgenius/dify-web:1.9.2`. 2. Include the environment variable `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX` in [./docker/docker-compose.yaml#L695-L716](https://github.com/langgenius/dify/blob/f7f6b4a8b0029dfd57cb7f3ef1e59f7cb5f09003/docker/docker-compose.yaml#L695-L716).
yindo added the 🐞 bug label 2026-02-21 20:05:41 -05:00
yindo closed this issue 2026-02-21 20:05:41 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 31, 2025):

Hi @Dave0126! I'm Dosu and I’m helping the dify team.

The inline formula rendering in Dify's frontend requires the environment variable NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX to be set at build time, not just at runtime. This is because Dify uses Next.js, which embeds NEXT_PUBLIC_ variables into the static frontend during the build process. Setting this variable in your Docker Compose environment or .env file after the image is built will not enable the feature in the official langgenius/dify-web:1.9.2 image (details, code reference).

To enable inline formula rendering, you need to build the frontend image yourself with NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=true set in the build environment. Here’s how you can do it:

  1. Clone the Dify repo and go to the web directory.
  2. Create or edit a .env file in web/ and set:
    NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=true
    
  3. Build the frontend image:
    docker build -t custom-dify-web:1.9.2 .
    
  4. In your docker-compose.yaml, use your custom image for the web service:
    web:
      image: custom-dify-web:1.9.2
      ...
    
  5. Restart your containers.

This will ensure the variable is present at build time and inline formulas will render as expected. If you use the official image, this feature will remain disabled until the maintainers publish an updated image built with the variable enabled (PR #27070).

Note: Enabling single-dollar inline LaTeX can cause conflicts with regular text, so use with care in production environments.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Oct 31, 2025): <!-- Greeting --> Hi @Dave0126! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The inline formula rendering in Dify's frontend requires the environment variable `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX` to be set at build time, not just at runtime. This is because Dify uses Next.js, which embeds `NEXT_PUBLIC_` variables into the static frontend during the build process. Setting this variable in your Docker Compose environment or `.env` file after the image is built will not enable the feature in the official `langgenius/dify-web:1.9.2` image ([details](https://github.com/langgenius/dify/pull/27070), [code reference](https://github.com/langgenius/dify/blob/f7f6b4a8b0029dfd57cb7f3ef1e59f7cb5f09003/web/.env.example)). To enable inline formula rendering, you need to build the frontend image yourself with `NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=true` set in the build environment. Here’s how you can do it: 1. Clone the Dify repo and go to the `web` directory. 2. Create or edit a `.env` file in `web/` and set: ``` NEXT_PUBLIC_ENABLE_SINGLE_DOLLAR_LATEX=true ``` 3. Build the frontend image: ``` docker build -t custom-dify-web:1.9.2 . ``` 4. In your `docker-compose.yaml`, use your custom image for the `web` service: ```yaml web: image: custom-dify-web:1.9.2 ... ``` 5. Restart your containers. This will ensure the variable is present at build time and inline formulas will render as expected. If you use the official image, this feature will remain disabled until the maintainers publish an updated image built with the variable enabled ([PR #27070](https://github.com/langgenius/dify/pull/27070)). **Note:** Enabling single-dollar inline LaTeX can cause conflicts with regular text, so use with care in production environments. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/028f98ae-bed3-4e32-8ac1-13999cbde086?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27697)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20062