Redocly / Redocly/redoc

Code sample highlighting removed after load

Open
#1,844 2 comments 3 reactions 1 assignee View on GitHub

@Oprysk is already working on this.

Since Dec 31, 2021.

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

Description

Describe the bug

Once the API documentation has finished loading, all free-form code samples that were previously highlighted show up as plaintext (with the DOM nodes responsible for highlighting removed from the <code> blocks).

This only affects redoc-cli bundle app.yaml. redoc-cli serve app.yaml keeps the code highlighting as expected.

Expected behaviour

Code samples are highlighted in production builds.

Minimal reproducible OpenAPI snippet(if possible)

(Note: more obvious with larger spec files that take longer to render DOM - this example is near instant)

// package.json
{
  "scripts": {
    "build": "openapi bundle --output app.yaml",
    "serve": "redoc-cli serve app.yaml",
    "bundle": "redoc-cli bundle app.yaml --output docs/index.html",
    "start": "npm run build && npm run serve",
    "start:bundle": "npm run build && npm run bundle"
  },
  "dependencies": {
    "@redocly/openapi-cli": "^1.0.0-beta.76",
    "redoc-cli": "^0.13.2"
  }
}
# openapi.yaml
openapi: 3.0.2
info:
  title:  API
  version: 0.1.0
  description:
    $ref: "./description.md"
servers:
  - url: 'https://api.example.com'
    description: Production Server
<!-- documentation.md -->
# Introduction

### Registration Request

#### application/json

```json5
{
    client_name: "<desired client name>",
    token_endpoint_auth_method: "client_secret_basic|client_secret_post",
    scopes: ["<desired scope>"], // Optional, if not provided you will obtain default scopes
    grant_types: ["authorization_code", "client_credentials", "refresh_token"], // Optional, default is authorization_code
    redirect_uris: ["<HTTPS URI>"], // Required if authorization_code grant was requested
    isProtectedResource: true|false,
    scopePrefix: "<scope prefix>"   // Required for protected resources
}

Screenshots

https://user-images.githubusercontent.com/3440094/147754111-63abeedb-c41a-490a-85eb-5eceae8ac147.mov

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.