mirror of
https://github.com/rendercv/rendercv.git
synced 2026-08-02 19:37:16 -04:00
Add centered section title types and bump rendercv-typst to 0.3.0
Add four new section title styles: `centered_without_line`, `centered_with_partial_line` (baseline), `centered_with_centered_partial_line` (middle-aligned), and `centered_with_full_line`. These allow section headings to be centered with various line decorations, complementing the existing left-aligned options.
This commit is contained in:
@@ -179,7 +179,7 @@ design:
|
||||
`justified` spreads text across the full width, `justified-with-no-hyphenation` does the same without breaking words
|
||||
3. **Header alignment:** << available_alignments >>
|
||||
4. **Section title styles:** << available_section_title_types >>
|
||||
`with_partial_line` adds a line next to the title, `with_full_line` spans the page, `without_line` has no line, `moderncv` uses ModernCV style
|
||||
`with_partial_line` adds a line next to the title, `with_full_line` spans the page, `without_line` has no line, `moderncv` uses ModernCV style, `centered_without_line` centers the title with no line, `centered_with_partial_line` centers with baseline partial lines on both sides, `centered_with_centered_partial_line` centers with middle-aligned lines on both sides, `centered_with_full_line` centers with a full line underneath
|
||||
5. **Show time spans:** Specify which sections should display duration calculations (e.g., "2 years 3 months")
|
||||
6. **Bullet characters:** << available_bullets >>
|
||||
7. **Phone number formats:** << available_phone_number_formats >>
|
||||
|
||||
@@ -26,13 +26,13 @@ typst init @preview/rendercv
|
||||
Or import into an existing file:
|
||||
|
||||
```typst
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typst
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
#show: rendercv.with(
|
||||
name: "John Doe",
|
||||
@@ -114,7 +114,7 @@ Everything is customizable through `rendercv.with()`. A few examples:
|
||||
header-connections-show-icons: true,
|
||||
|
||||
// Section titles
|
||||
section-titles-type: "with_partial_line", // "with_full_line", "moderncv"
|
||||
section-titles-type: "with_partial_line", // "with_full_line", "without_line", "moderncv", "centered_without_line", "centered_with_partial_line", "centered_with_centered_partial_line", "centered_with_full_line"
|
||||
|
||||
// Entries
|
||||
entries-date-and-location-width: 4.15cm,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RTL (Right-to-Left) example with Persian content.
|
||||
// Requires a Persian font such as "Vazirmatn" to be installed.
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
#show: rendercv.with(
|
||||
name: "علی احمدی",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -602,7 +602,8 @@
|
||||
|
||||
// Section titles:
|
||||
#show heading.where(level: 2): it => [
|
||||
#set align(start-align)
|
||||
#let is-centered = section-titles-type in ("centered_without_line", "centered_with_partial_line", "centered_with_centered_partial_line", "centered_with_full_line")
|
||||
#set align(if is-centered { center } else { start-align })
|
||||
#set text(size: (1em / 1.2)) // reset
|
||||
#set text(
|
||||
font: typography-font-family-section-titles,
|
||||
@@ -640,6 +641,30 @@
|
||||
#section-title
|
||||
],
|
||||
)
|
||||
] else if section-titles-type == "centered_without_line" [
|
||||
#section-title
|
||||
] else if section-titles-type == "centered_with_partial_line" [
|
||||
#grid(
|
||||
columns: (1fr, auto, 1fr),
|
||||
align: (bottom, center + bottom, bottom),
|
||||
column-gutter: 0.3em,
|
||||
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
||||
[#section-title],
|
||||
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
||||
)
|
||||
] else if section-titles-type == "centered_with_centered_partial_line" [
|
||||
#grid(
|
||||
columns: (1fr, auto, 1fr),
|
||||
align: (horizon, center, horizon),
|
||||
column-gutter: 0.3em,
|
||||
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
||||
[#section-title],
|
||||
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
||||
)
|
||||
] else if section-titles-type == "centered_with_full_line" [
|
||||
#section-title
|
||||
#v(typography-font-size-body * 0.3)
|
||||
#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)
|
||||
] else [
|
||||
#section-title
|
||||
#if section-titles-type == "with_partial_line" [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rendercv"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Sina Atalay <dev@atalay.biz>"]
|
||||
license = "MIT"
|
||||
|
||||
3965
schema.json
3965
schema.json
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -11,7 +11,14 @@ type Bullet = Literal["●", "•", "◦", "-", "◆", "★", "■", "—", "○
|
||||
type BodyAlignment = Literal["left", "justified", "justified-with-no-hyphenation"]
|
||||
type Alignment = Literal["left", "center", "right"]
|
||||
type SectionTitleType = Literal[
|
||||
"with_partial_line", "with_full_line", "without_line", "moderncv"
|
||||
"with_partial_line",
|
||||
"with_full_line",
|
||||
"without_line",
|
||||
"moderncv",
|
||||
"centered_without_line",
|
||||
"centered_with_partial_line",
|
||||
"centered_with_centered_partial_line",
|
||||
"centered_with_full_line",
|
||||
]
|
||||
type PhoneNumberFormatType = Literal["national", "international", "E164"]
|
||||
type PageSize = Literal["a4", "a5", "us-letter", "us-executive"]
|
||||
@@ -420,8 +427,12 @@ class SectionTitles(BaseModelWithoutExtraKeys):
|
||||
description=(
|
||||
"Section title visual style. Use 'with_partial_line' for a line next to the"
|
||||
" title, 'with_full_line' for a line across the page, 'without_line' for no"
|
||||
" line, or 'moderncv' for the ModernCV style. The default value is"
|
||||
" `with_partial_line`."
|
||||
" line, 'moderncv' for the ModernCV style, 'centered_without_line' for a"
|
||||
" centered title with no line, 'centered_with_partial_line' for a centered"
|
||||
" title with baseline partial lines on both sides,"
|
||||
" 'centered_with_centered_partial_line' for a centered title with"
|
||||
" middle-aligned lines on both sides, or 'centered_with_full_line' for a"
|
||||
" full-width line underneath. The default value is `with_partial_line`."
|
||||
),
|
||||
)
|
||||
line_thickness: TypstDimension = pydantic.Field(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Import the rendercv function and all the refactored components
|
||||
#import "@preview/rendercv:0.2.0": *
|
||||
#import "@preview/rendercv:0.3.0": *
|
||||
|
||||
// Apply the rendercv template with custom configuration
|
||||
#show: rendercv.with(
|
||||
|
||||
Reference in New Issue
Block a user