-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
417 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Pavel Zwerschke | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# moderner-cv | ||
|
||
[![License][license-badge]][license] | ||
[![CI][ci-badge]][ci] | ||
[![Latest release][latest-release-badge]][typst-universe] | ||
|
||
[license-badge]: https://img.shields.io/github/license/pavelzw/moderner-cv?style=flat-square | ||
[license]: ./LICENSE | ||
[ci-badge]: https://img.shields.io/github/actions/workflow/status/pavelzw/moderner-cv/ci.yml?style=flat-square | ||
[ci]: https://github.com/pavelzw/moderner-cv/actions/ | ||
[latest-release-badge]: https://img.shields.io/github/v/tag/pavelzw/moderner-cv?style=flat-square&label=latest&sort=semver | ||
[typst-universe]: https://typst.app/universe/package/moderner-cv | ||
|
||
This is a typst adaptation of LaTeX's [moderncv](https://github.com/moderncv/moderncv), a modern curriculum vitae class. | ||
|
||
## Requirements | ||
|
||
This template uses FontAwesome icons via the [fontawesome typst package](https://typst.app/universe/package/fontawesome). | ||
In order to properly use it, you need to have fontawesome installed on your system or have typst configured (via `--font-path`) to use the fontawesome font files. | ||
You can download fontawesome [here](https://fontawesome.com/download). | ||
|
||
> [!TIP] | ||
> You can use typst in combination with [pixi](https://pixi.sh) to easily add fontawesome to your project and run it reproducibly anywhere. | ||
> | ||
> ```toml | ||
> [dependencies] | ||
> typst = ">=0.12.0" | ||
> typstyle = ">=0.12" | ||
> font-otf-fontawesome = "*" | ||
> ``` | ||
## Usage | ||
```typst | ||
#import "@preview/moderner-cv:0.1.2": * | ||
#show: moderner-cv.with( | ||
name: "Jane Doe", | ||
lang: "en", | ||
social: ( | ||
email: "[email protected]", | ||
github: "jane-doe", | ||
linkedin: "jane-doe", | ||
// custom socials: (icon, link, body) | ||
// any fontawesome icon can be used: https://fontawesome.com/search | ||
website: ("link", "https://example.me", "example.me"), | ||
image-path: "/my-image.png", | ||
), | ||
) | ||
// ... | ||
``` | ||
### Image | ||
|
||
To add an image to your curriculum vitae, you can a path to that image to the `image-path` parameter (the path should be from the root of your project and start with a `/`). Here are the additional parameters: | ||
|
||
- `image-height`: size of the image | ||
- `image-frame-stroke`: stroke of the frame. By default is 1pt + the main of the file. Can be any stroke value. Set to `none` to remove the frame. | ||
|
||
## Examples | ||
|
||
![Jane Doe's CV](assets/thumbnail.png) | ||
|
||
## Building and Testing Locally | ||
|
||
To build and test the template locally, you can run `pixi run watch` in the root of this repository. | ||
Please ensure to use the version of moderner-cv that is in this repository instead of the one on the typst universe by temporarily changing the import in [`cv.typ`](./template/cv.typ) to `#import "../lib.typ": *`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
#import "@preview/fontawesome:0.5.0": * | ||
|
||
#let _cv-line(left, right, ..args) = { | ||
set block(below: 0pt) | ||
table( | ||
columns: (1fr, 5fr), | ||
stroke: none, | ||
..args.named(), | ||
left, | ||
right, | ||
) | ||
} | ||
#let moderncv-blue = rgb("#3973AF") | ||
|
||
#let _header( | ||
title: [], | ||
subtitle: [], | ||
image-path: none, | ||
image-height: none, | ||
image-frame-stroke: auto, | ||
color: moderncv-blue, | ||
socials: (:), | ||
) = { | ||
let titleStack = stack( | ||
dir: ttb, | ||
spacing: 1em, | ||
text(size: 30pt, title), | ||
text(size: 20pt, subtitle), | ||
) | ||
|
||
let social(icon, link_prefix, username) = [ | ||
#fa-icon(icon) #link(link_prefix + username)[#username] | ||
] | ||
|
||
let custom-social(icon, dest, body) = [ | ||
#fa-icon(icon) #link(dest, body) | ||
] | ||
|
||
let socialsDict = ( | ||
// key: (faIcon, linkPrefix) | ||
phone: ("phone", "tel:"), | ||
email: ("envelope", "mailto:"), | ||
github: ("github", "https://github.com/"), | ||
linkedin: ("linkedin", "https://linkedin.com/in/"), | ||
x: ("x-twitter", "https://twitter.com/"), | ||
bluesky: ("bluesky", "https://bsky.app/profile/"), | ||
) | ||
|
||
let socialsList = () | ||
for entry in socials { | ||
assert(type(entry) == array, message: "Invalid social entry type.") | ||
assert(entry.len() == 2, message: "Invalid social entry length.") | ||
let (key, value) = entry | ||
if type(value) == str { | ||
if key not in socialsDict { | ||
panic("Unknown social key: " + key) | ||
} | ||
let (icon, linkPrefix) = socialsDict.at(key) | ||
socialsList.push(social(icon, linkPrefix, value)) | ||
} else if type(value) == array { | ||
assert(value.len() == 3, message: "Invalid social entry: " + key) | ||
let (icon, dest, body) = value | ||
socialsList.push(custom-social(icon, dest, body)) | ||
} else { | ||
panic("Invalid social entry: " + entry) | ||
} | ||
} | ||
|
||
let socialStack = stack( | ||
dir: ttb, | ||
spacing: 0.5em, | ||
..socialsList, | ||
) | ||
|
||
let imageStack = [] | ||
|
||
if image-path != none { | ||
let image = image(image-path, height: image-height) | ||
|
||
let imageFramed = [] | ||
|
||
if image-frame-stroke == none { | ||
// no frame | ||
imageFramed = image | ||
} else { | ||
if image-frame-stroke == auto { | ||
// default stroke | ||
image-frame-stroke = 1pt + color | ||
} else { | ||
image-frame-stroke = stroke(image-frame-stroke) | ||
if image-frame-stroke.paint == auto { | ||
// use the main color by default | ||
// fields on stroke are not yet mutable | ||
image-frame-stroke = stroke(( | ||
paint: color, | ||
thickness: image-frame-stroke.thickness, | ||
cap: image-frame-stroke.cap, | ||
join: image-frame-stroke.join, | ||
dash: image-frame-stroke.dash, | ||
miter-limit: image-frame-stroke.miter-limit, | ||
)) | ||
} | ||
} | ||
imageFramed = rect(image, stroke: image-frame-stroke) | ||
} | ||
|
||
imageStack = stack( | ||
dir: ltr, | ||
h(1em), | ||
imageFramed, | ||
) | ||
} | ||
|
||
stack( | ||
dir: ltr, | ||
titleStack, | ||
align( | ||
right + top, | ||
socialStack, | ||
), | ||
imageStack, | ||
) | ||
} | ||
|
||
#let moderner-cv( | ||
name: [], | ||
subtitle: [CV], | ||
social: (:), | ||
color: moderncv-blue, | ||
lang: "en", | ||
font: "New Computer Modern", | ||
image-path: none, | ||
image-height: 8em, | ||
image-frame-stroke: auto, | ||
paper: "a4", | ||
margin: ( | ||
top: 10mm, | ||
bottom: 15mm, | ||
left: 15mm, | ||
right: 15mm, | ||
), | ||
show-footer: true, | ||
body, | ||
) = [ | ||
#set page( | ||
paper: paper, | ||
margin: margin, | ||
) | ||
#set text( | ||
font: font, | ||
lang: lang, | ||
) | ||
|
||
#show heading: it => { | ||
set text(weight: "regular") | ||
set text(color) | ||
set block(above: 0pt) | ||
_cv-line( | ||
[], | ||
[#it.body], | ||
) | ||
} | ||
#show heading.where(level: 1): it => { | ||
set text(weight: "regular") | ||
set text(color) | ||
_cv-line( | ||
align: horizon, | ||
[#box(fill: color, width: 28mm, height: 0.25em)], | ||
[#it.body], | ||
) | ||
} | ||
|
||
#_header( | ||
title: name, | ||
subtitle: subtitle, | ||
image-path: image-path, | ||
image-height: image-height, | ||
image-frame-stroke: image-frame-stroke, | ||
color: color, | ||
socials: social, | ||
) | ||
|
||
#body | ||
|
||
#if show-footer [ | ||
#v(1fr, weak: false) | ||
#name\ | ||
#datetime.today().display("[month repr:long] [day], [year]") | ||
] | ||
] | ||
#let cv-line(left-side, right-side) = { | ||
_cv-line( | ||
align(right, left-side), | ||
par(right-side, justify: true), | ||
) | ||
} | ||
#let cv-entry( | ||
date: [], | ||
title: [], | ||
employer: [], | ||
..description, | ||
) = { | ||
let elements = ( | ||
strong(title), | ||
emph(employer), | ||
..description.pos(), | ||
) | ||
cv-line( | ||
date, | ||
elements.join(", "), | ||
) | ||
} | ||
#let cv-language(name: [], level: [], comment: []) = { | ||
_cv-line( | ||
align(right, name), | ||
stack(dir: ltr, level, align(right, emph(comment))), | ||
) | ||
} | ||
#let cv-double-item(left-1, right-1, left-2, right-2) = { | ||
set block(below: 0pt) | ||
table( | ||
columns: (1fr, 2fr, 1fr, 2fr), | ||
stroke: none, | ||
align(right, left-1), right-1, align(right, left-2), right-2, | ||
) | ||
} | ||
#let cv-list-item(item) = { | ||
_cv-line( | ||
[], | ||
list(item), | ||
) | ||
} | ||
#let cv-list-double-item(item1, item2) = { | ||
set block(below: 0pt) | ||
table( | ||
columns: (1fr, 2.5fr, 2.5fr), | ||
stroke: none, | ||
[], list(item1), list(item2), | ||
) | ||
} |
Oops, something went wrong.