YAMLResume

rendercv2yamlresume

使用 rendercv2yamlresume 将现有的 RenderCV YAML 文件转换为 YAMLResume 格式,包括章节、字段和词汇表映射。

rendercv2yamlresume 是一个命令行工具,用于将 RenderCV YAML 文件转换为 YAMLResume 格式。

RenderCV 与 YAMLResume 共享同一个理念——简历就是一个文本文件——但两者对数据的建模方式不同。RenderCV 允许每个章节标题是任意字符串,并据此推断每个章节的条目类型; YAMLResume 则拥有一组固定的章节键、稳定的字段名,以及针对 degree 等取值的受控词汇表。本工具在两者之间架起桥梁。

功能

  • 章节映射:experience → work、selected_honors → awards,以及 RenderCV 官方示例中使用的其他名称
  • 字段映射:company/position → name/position、journal → publisher、label/details → 技能 name/keywords 等
  • 词汇表映射:自由格式的学位(PhD、BS、M.Sc.)和社交网络(X、 StackOverflow)会被映射到 YAMLResume 的固定列表中
  • 日期处理:start_date/end_date 区间变为 startDate/endDate,单个 date 变为区间的起点,present 会被丢弃,因为空的 endDate 已经渲染为 "Present"
  • 尽力而为的转换并输出报告:YAMLResume 无法表达的任何内容都会被列出,而不会被静默丢弃
  • 验证:结果在写入前会依据 YAMLResume 自身的 schema 进行检查

安装

npm install -g rendercv2yamlresume
pnpm add -g rendercv2yamlresume
yarn global add rendercv2yamlresume
bun add -g rendercv2yamlresume

用法

# Convert and write alongside the input file
rendercv2yamlresume John_Doe_CV.yaml

# Or choose the output path
rendercv2yamlresume John_Doe_CV.yaml resume.yml

# Write even if the result does not validate
rendercv2yamlresume John_Doe_CV.yaml --force

省略 output-file 时,结果会以 .yml 扩展名写在输入文件旁边,因此 John_Doe_CV.yaml 会变成 John_Doe_CV.yml。如果输入文件本身就以 .yml 结尾,推导出的路径会与输入相同,此时请显式指定输出路径,或使用 --force 覆盖输入文件。

命令成功时以 0 退出;当输入无法读取、没有 cv 块、使用了不支持的区域语言、产生的简历无法通过验证,或者在未加 --force 的情况下会覆盖输入文件时,以 1 退出。 --force 允许输出无效结果以及输入/输出路径相同,但不允许不受支持的区域语言。

代码含义
0已转换并写入(可能带有已报告的问题)
1输入缺失、无法解析、没有 cv 块、使用了不支持的区域语言、验证失败,或在未加 --force 的情况下会覆盖输入文件

示例

输入:

John_Doe_CV.yaml
cv:
  name: John Doe
  headline: Backend Engineer
  email: [email protected]
  location: San Francisco, CA
  social_networks:
    - network: LinkedIn
      username: rendercv
  sections:
    education:
      - institution: Princeton University
        area: Computer Science
        degree: PhD
        start_date: 2018-09
        end_date: 2023-05
    experience:
      - company: Nexus AI
        position: Co-Founder & CTO
        start_date: 2023-06
        end_date: present
        highlights:
          - Built foundation model infrastructure serving 2M+ monthly API requests
    selected_honors:
      - bullet: Forbes 30 Under 30 in Enterprise Technology (2024)

输出:

resume.yml
---
content:
  basics:
    name: John Doe
    headline: Backend Engineer
    email: [email protected]
  location:
    city: San Francisco
    region: CA
  profiles:
    - network: LinkedIn
      username: rendercv
  education:
    - institution: Princeton University
      area: Computer Science
      degree: Doctor
      startDate: 2018-09
      endDate: 2023-05
  work:
    - name: Nexus AI
      position: Co-Founder & CTO
      startDate: 2023-06
      summary: '- Built foundation model infrastructure serving 2M+ monthly API requests'
  awards:
    - title: Forbes 30 Under 30 in Enterprise Technology
      awarder: Unknown
      date: '2024'

转换规则

章节

RenderCV 的章节标题是任意字符串。与已知别名匹配的标题会被映射;其他标题会被丢弃并报告。下划线、连续空格和全角 Unicode 字符会被规范化,因此 selected_honors 和 Selected Honors 都可以正常工作。除下面的英文别名外,YAMLResume 支持的所有区域语言中的规范章节标题也会被自动识别。

RenderCV 标题YAMLResume 键
education, education_and_trainingeducation
experience, work, employment, professional_experience, work_experiencework
projects, personal_projectsprojects
publicationspublications
skills, technical_skillsskills
languageslanguages
interestsinterests
awards, honors, selected_honors, honors_and_awardsawards
certificates, certificationscertificates
volunteer, volunteer_experiencevolunteer
referencesreferences

如果两个标题映射到同一个键(例如 experience 和 work 同时出现),它们的条目会被追加而不是相互覆盖。

条目

RenderCV 条目行为
ExperienceEntry→ work 或 volunteer 条目;company → name/organization,position 保留
EducationEntry→ education 条目;学位被映射到固定列表
PublicationEntry→ publication 条目;title → name,journal → publisher
NormalEntry→ project 或 certificate 条目;[Name](url) 形式的名称会被拆分为 name + url
OneLineEntry→ skill、language、interest 或 reference 条目,取决于所在章节
BulletEntry / 字符串→ awards 章节中的 award 条目,否则会被报告

取值

  • 学位按不区分大小写和标点的方式映射:PhD、Ph.D.、Doctorate → Doctor; BS、BSc、Bachelor of Science → Bachelor;MSc、M.S.、MBA → Master。
  • 社交网络会与 YAMLResume 的列表匹配:X → Twitter,StackOverflow → Stack Overflow。没有对应项的网络(ORCID、ResearchGate、Mastodon)会被丢弃并报告。
  • 区域语言会把 RenderCV 的名称(english、mandarin_chinese)映射到 YAMLResume 的代码(en、zh-hans)。如果 YAMLResume 不支持所请求的区域语言,转换会以警告停止,并且不会写出输出文件。
  • 语言和熟练度会与 YAMLResume 的固定列表进行不区分大小写的匹配,并支持 Native、Fluent 等别名。不受支持的值会被丢弃并报告。
  • 日期原样传递,唯一的例外是 present 会被丢弃。
  • Headline、email、phone 和 website 会被复制;如果 RenderCV 为 email/phone/website 提供了列表,则使用第一个值,其余值会被报告。

限制

这是一个迁移辅助工具,而不是无损的双向转换。两种数据模型并不等价,部分信息无法跨越边界。任何内容都不会在未报告的情况下被丢弃,每次丢弃都会指出导致它的字段。

完全无法表达——会被丢弃并报告:

  • 任意章节。 patents、invited_talks、Things I Did——任何在 YAMLResume 中没有对应项的章节。
  • 逐元素样式。 整个 RenderCV design 块:逐元素颜色、字体、字号、间距、页眉对齐、照片位置、章节标题样式以及 Jinja2 模板覆盖。YAMLResume 在 layouts[] 下按引擎配置布局。
  • settings。 pdf_title、current_date、bold_keywords 以及渲染命令选项描述的是某次渲染运行,而不是简历数据。
  • 头像照片。 YAMLResume 没有照片字段。
  • 自定义页眉联系信息。 带有 Font Awesome 图标的 custom_connections 在 YAMLResume 的页眉中没有对应的位置。
  • 条目位置。 YAMLResume 支持页眉位置,但 education、work、project 和 volunteer 条目上没有位置字段。
  • Typst 数学和命令。 文本字段中的 $inline math$ 和 #emph[...] 会作为字面文本保留,而不是排版后的输出。

可表达,但存在需要你复核的损失——每种情况都会被报告:

  • OneLineEntry → skills 会丢失熟练度等级。 YAMLResume 要求提供等级,因此转换器会写入 level: Intermediate。请调整每一个技能条目。
  • 裸项目符号 → awards 会编造颁奖方。 转换器会写入 awarder: Unknown,并列出每个奖项以便你补充。
  • 证书会编造颁发方。 转换后的证书使用 issuer: Unknown,并会被报告以便复核。
  • NormalEntry → projects 需要起始日期。 既没有 start_date 也没有 date 的条目会被丢弃并报告。
  • Highlights 会变成 summary 中的 Markdown 项目符号。 RenderCV 将 summary 和 highlights 分开保存;YAMLResume 只有一个富文本字段。
  • summary 有最小长度限制。 合并后摘要短于 16 个字符的条目仍会被转换,但会被报告以便你扩充内容。
  • Publication 的 publisher 是推导出来的。 转换器依次使用 journal、作者列表,最后是 Unknown。当存在 journal 时,作者会被丢弃。
  • 单个 date 会变成一个 startDate。 YAMLResume 没有单日期字段,因此按区间没有日期的条目会成为有起始日期的条目,而不是浮动条目。
  • 词汇表之外的自由格式学位会被丢弃。 Habilitation、Licentiate 等在 YAMLResume 的七个学位中没有对应项。请手动添加该条目,并使用如 Doctor 这类已映射的学位。
  • location 在 RenderCV 中是单个字符串。 转换器会按逗号拆分,当最后一段与 YAMLResume 的列表匹配时视为国家,否则视为地区。请核实结果。
  • 多个 email/phone/website 值。 只保留第一个值,被丢弃的值会被报告。

按设计不转换:

  • RenderCV 的 locale.phrases、month_names 和 month_abbreviations。 YAMLResume 为其支持的区域语言自带翻译;请使用它的 locale 块。

相关项目

Edit on GitHub

Last updated on

On this page