Molfig: Render molecular structures (PDB/mmCIF/BinaryCIF) directly in Typst

Hi all!

I’ve been working on Molfig, a package that renders molecular structure files (PDB / mmCIF / BinaryCIF) as static figures directly in Typst documents, and wanted to share it here.

Molfig parses structure data on the CPU using a Mol*-like (molstar.org) Model/Structure/Unit layering, exports static meshes (OBJ / STL / PLY), and hands off the final rendering to maquette. The core is implemented as a Rust-based WASM plugin.

Key features:

  • Input formats: PDB, text CIF/mmCIF, and BinaryCIF
  • Representations: Mol* default, spacefill, ball-and-stick, cartoon, ribbon, and backbone
  • Support for biological assemblies and altLoc (alternate conformation) selection
  • API: render, render-object, to-obj, to-mtl, to-stl, to-ply, info, mesh-info

Limitations:

Since it’s focused on static mesh export, it doesn’t support Mol*'s interactive WebGL rendering, molecular surfaces, or volumetric rendering.

Links:

Here’s a sample render:

I think this could be useful for embedding structural figures in papers, reports, or other static documents. Would love any feedback, bug reports, or feature requests!

2 Likes