Redocly / Redocly/redoc

bundle should be able to inline images

Open
#2,755 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In order to produce consistent documentation with images I need to inline images (SVG, PNG, Jpeg) as base64 with proper mimetype. AI build a wrapper script with a shell function inline_images that does the job for me:

$REDOCLY bundle "$src" -o "$out_json" --ext json 
inline_images "$out_json" "$src"

It works fine with input in yaml:

<img style="float:right; margin:0 0 1.2em 1.2em; max-width:50%; height:auto;" src="../images/partner_logic.svg" alt="Partner SYNC Logik" />

converted to:

<img style="float:right; margin:0 0 1.2em 1.2em; max-width:50%; height:auto;" src="data:image/svg+xml;base64,PD94bWwgdmVy...

But I think redocly should be able to do inlining and setting mimetype by filename extension (.svg > image/svg+xml) for most used file types like svg and png.

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 tracing the TypeScript implementation of the bundle command and how image references are handled. Check SVG, PNG, and JPEG inputs and their filename-derived MIME types; done means bundled output contains base64 data URLs with correct MIME types. The issue names no source files or tests, so locate the relevant entry point and test coverage first.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.