npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rendercv-to-docx

v1.2.0

Published

Convert RenderCV-generated Typst (.typ) files to DOCX format

Readme

rendercv-to-docx

Convert RenderCV-generated Typst (.typ) files to Microsoft Word DOCX format.

What is this?

RenderCV is a LaTeX/Typst CV generator that takes a YAML file and produces beautifully typeset PDFs. This tool takes the Typst output from RenderCV and converts it to DOCX format for situations where you need an editable Word document.

⚠️ Important: This is NOT a generic Typst converter. It only works with RenderCV-generated Typst files and their specific template syntax.

Why would I need this?

  • Some job application systems only accept DOCX files
  • You need to make quick edits without regenerating the PDF
  • Your recruiter or HR department needs an editable version
  • ATS (Applicant Tracking Systems) sometimes prefer DOCX over PDF

Installation

# Clone the repository
git clone https://github.com/anefzaoui/rendercv-to-docx.git
cd rendercv-to-docx

# Install dependencies
npm install

Usage

Command Line

# Basic conversion
node src/cli.js John_Doe_CV.typ

# Specify output file
node src/cli.js John_Doe_CV.typ resume.docx

# Verbose output
node src/cli.js John_Doe_CV.typ --verbose

# Parse only (output AST as JSON)
node src/cli.js John_Doe_CV.typ --parse > ast.json

# Show help
node src/cli.js --help

Programmatic API

import { convertToDocx, convertFile, parse } from 'rendercv-to-docx';
import fs from 'fs';

// Convert file directly
await convertFile('John_Doe_CV.typ', 'John_Doe_CV.docx');

// Convert content string to DOCX buffer
const content = fs.readFileSync('John_Doe_CV.typ', 'utf-8');
const buffer = await convertToDocx(content);
fs.writeFileSync('resume.docx', buffer);

// Parse Typst to AST (for debugging/inspection)
const ast = parse(content);
console.log(JSON.stringify(ast, null, 2));

Supported RenderCV Features

Header Information

| Feature | Supported | |---------|-----------| | name | ✅ | | headline | ✅ | | connections (email, phone, LinkedIn, GitHub, etc.) | ✅ | | photo | ❌ (photos not supported in DOCX output) |

Entry Types

| Entry Type | Supported | Notes | |------------|-----------|-------| | ExperienceEntry | ✅ | company, position, dates, location, highlights | | EducationEntry | ✅ | institution, degree, area, dates | | NormalEntry | ✅ | name, dates, location, highlights | | PublicationEntry | ✅ | title, authors, DOI, journal | | OneLineEntry | ✅ | label: details format | | BulletEntry | ✅ | Simple bullet points | | TextEntry | ✅ | Plain text paragraphs |

Formatting

| Feature | Supported | |---------|-----------| | #strong[text] | ✅ Bold | | #emph[text] | ✅ Italic | | #link("url")[text] | ✅ Hyperlinks | | Bullet lists (-) | ✅ | | Headings (=, ==) | ✅ | | Escaped characters (\/, \@, \%) | ✅ |

Design/Metadata

| Feature | Supported | |---------|-----------| | Colors (name, sections, links, body) | ✅ | | Font families | ✅ | | Font sizes | Partial (uses sensible defaults) | | Page margins | ❌ (uses Word defaults) | | Section title styles | ✅ (underlined headings) |

Example

Input (RenderCV Typst file):

#import "@preview/rendercv:0.1.0": *

#show: rendercv.with(
  name: "Jane Doe",
  colors-name: rgb(0, 79, 144),
  colors-section-titles: rgb(0, 79, 144),
)

= Jane Doe

#headline([Senior Software Engineer | Full-Stack Developer])

#connections(
  [#connection-with-icon("location-dot")[San Francisco, CA]],
  [#link("mailto:[email protected]")[jane\@example.com]],
)

== Experience

#regular-entry(
  [
    #strong[Acme Corp], Senior Engineer
    - Led migration to microservices architecture
    - Reduced deployment time by 80%
  ],
  [
    San Francisco, CA
    Jan 2020 – present
  ],
)

Output: A properly formatted DOCX file with:

  • Colored name and section headers
  • Clickable email/phone links
  • Properly structured experience entries with bullet points
  • Professional typography

API Reference

convertToDocx(content, options)

Convert Typst content string to DOCX buffer.

  • content string - Typst file content
  • options object - Optional conversion settings
  • Returns: Promise<Buffer> - DOCX file buffer

convertFile(inputPath, outputPath, options)

Convert Typst file to DOCX file.

  • inputPath string - Path to input .typ file
  • outputPath string - Path to output .docx file
  • options object - Optional conversion settings
  • Returns: Promise<{inputPath, outputPath, success}>

parse(content)

Parse Typst content and return AST.

  • content string - Typst file content
  • Returns: object - Parsed AST

generateDocx(ast, options)

Generate DOCX from parsed AST.

  • ast object - Parsed Typst AST
  • options object - Generation options
  • Returns: Promise<Buffer> - DOCX file buffer

Limitations

This tool is specifically designed for RenderCV output. It does NOT support:

  • ❌ Generic Typst documents
  • ❌ Custom Typst functions/macros
  • ❌ Typst scripting (loops, conditionals, variables)
  • ❌ Math equations
  • ❌ Tables
  • ❌ Images/photos
  • ❌ Multi-column layouts
  • ❌ Custom fonts (uses system fonts)

If you need a generic Typst → DOCX converter, you would need to essentially reimplement the Typst compiler, which is a massive undertaking.

How It Works

  1. Parse - Reads the Typst file and extracts:

    • Metadata from rendercv.with() configuration
    • Header info (name, headline, connections)
    • Sections and their entries
    • Inline formatting
  2. Transform - Converts the parsed AST to docx library structures:

    • Maps RenderCV entry types to Word paragraphs
    • Applies colors from metadata
    • Creates hyperlinks for connections
    • Formats bullet points and highlights
  3. Generate - Uses the docx library to produce the final DOCX file

Development

# Run tests
npm test

# Convert sample file
npm run convert

# Debug parsing
node src/cli.js sample.typ --parse | jq .

Related Projects

  • RenderCV - The CV generator that produces the Typst files this tool converts
  • Typst - The modern typesetting system
  • docx - The library used for DOCX generation

License

MIT