rendercv-to-docx
v1.2.0
Published
Convert RenderCV-generated Typst (.typ) files to DOCX format
Maintainers
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 installUsage
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 --helpProgrammatic 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
Parse - Reads the Typst file and extracts:
- Metadata from
rendercv.with()configuration - Header info (name, headline, connections)
- Sections and their entries
- Inline formatting
- Metadata from
Transform - Converts the parsed AST to
docxlibrary structures:- Maps RenderCV entry types to Word paragraphs
- Applies colors from metadata
- Creates hyperlinks for connections
- Formats bullet points and highlights
Generate - Uses the
docxlibrary 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
