typst / typst/typst

Base64 encoded images embedded in SVGs are not supported in DOCX or MS Word

Open
#7,040 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

svg
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

As of now, when including either raster or vector images into a document, and exporting to SVG format, typst always encodes the embedded images to base64.

While that's necessary for rasters, vectors could be embedded raw, without base64 encoding, and therefore would be loadable by Microsoft Word.

There was a recent PR implementing raw SVG embedding that was halted due to security concerns: #6814

And the related issue: #6812

I would propose to maybe put raw embedding behind a compiler flag, as to keep the more secure behavior as default, while still allowing Typst to produce fully MS Word-compatible SVGs.

Source about b64 embeds incompatibility with MS Word: https://learn.microsoft.com/en-us/answers/questions/1324557/is-word-document-read-base64-image-format?hl=it-IT

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 reviewing the halted raw SVG embedding PR #6814 and related issue #6812, then trace the SVG export behavior described here. Done means producing SVGs that Microsoft Word can load while retaining the secure default behavior, with any opt-in compiler flag defined clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.