Redocly / Redocly/redoc

Multiline string examples render wrong

Open
#1,385 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

If a string example includes \n (newline) characters, these are not honored when rendering examples.

Say you have a parameter like this:

        parameters:
        - description: The contents of the `php.ini` file.
          in: query
          name: content
          schema:
            example: |
              [PHP]
              ; About php.ini
              ; php.ini is responsible for configuring many of the aspects of PHP's behavior.
              pcre.backtrack_limit=100000
            type: string

The Example printed to the output places the example on lines ignoring the \n characters.

current

Where as I would have expected something similar to:

desired

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided OpenAPI parameter example and inspect the rendering path for string examples. Done means the generated documentation preserves the example's newline characters and displays each line separately, matching the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.