rendercv.renderer
¶
The rendercv.renderer
package contains the necessary classes and functions for
generating Typst, PDF, Markdown, HTML, and PNG files from the RenderCVDataModel
object.
The Typst and Markdown files are generated with
Jinja2 templates. Then, the Typst
file is rendered into a PDF and PNGs with
typst
package. The Markdown file is rendered
into an HTML file with
markdown
package.
create_a_markdown_file(rendercv_data_model, output_directory)
¶
Render the Markdown file with the given data model and write it to the output directory.
Parameters:
-
rendercv_data_model
(RenderCVDataModel
) –The data model.
-
output_directory
(Path
) –Path to the output directory.
Returns:
-
Path
–The path to the rendered Markdown file.
Source code in rendercv/renderer/renderer.py
create_a_typst_file(rendercv_data_model, output_directory)
¶
Create a Typst file (depending on the theme) with the given data model and write it to the output directory.
Parameters:
-
rendercv_data_model
(RenderCVDataModel
) –The data model.
-
output_directory
(Path
) –Path to the output directory. If not given, the Typst file will be returned as a string.
Returns:
-
Path
–The path to the generated Typst file.
Source code in rendercv/renderer/renderer.py
create_a_typst_file_and_copy_theme_files(rendercv_data_model, output_directory)
¶
Render the Typst file with the given data model in the output directory and copy the auxiliary theme files to the output directory.
Parameters:
-
rendercv_data_model
(RenderCVDataModel
) –The data model.
-
output_directory
(Path
) –Path to the output directory.
Returns:
-
Path
–The path to the rendered Typst file.
Source code in rendercv/renderer/renderer.py
create_contents_of_a_typst_file(rendercv_data_model)
¶
Create a Typst file with the given data model and return it as a string.
Parameters:
-
rendercv_data_model
(RenderCVDataModel
) –The data model.
Returns:
-
str
–The path to the generated Typst file.
Source code in rendercv/renderer/renderer.py
render_a_pdf_from_typst(file_path)
¶
Run TinyTeX with the given Typst file to render the PDF.
Parameters:
-
file_path
(Path
) –The path to the Typst file.
Returns:
-
Path
–The path to the rendered PDF file.
Source code in rendercv/renderer/renderer.py
render_an_html_from_markdown(markdown_file_path)
¶
Render an HTML file from a Markdown file with the same name and in the same
directory. It uses rendercv/themes/main.j2.html
as the Jinja2 template.
Parameters:
-
markdown_file_path
(Path
) –The path to the Markdown file.
Returns:
-
Path
–The path to the rendered HTML file.
Source code in rendercv/renderer/renderer.py
render_pngs_from_typst(file_path, ppi=150)
¶
Run Typst with the given Typst file to render the PNG files.
Parameters:
-
file_path
(Path
) –The path to the Typst file.
-
ppi
(float
, default:150
) –Pixels per inch for PNG output, defaults to 150.
Returns:
-
list[Path]
–Paths to the rendered PNG files.