docs: update

This commit is contained in:
Sina Atalay
2024-06-17 21:57:50 +03:00
parent 031687f5ab
commit 75169637c3
19 changed files with 329 additions and 306 deletions

View File

@@ -0,0 +1,18 @@
# Frequently Asked Questions (FAQ)
## How can I add a new social network to RenderCV?
To add a new social network to RenderCV, go to the `rendercv/data_models.py` file and follow these steps:
1. Append the social network name (for example, "Facebook") to the `SocialNetworkName` type.
2. If necessary, implement its username validation in the `SocialNetwork.check_username` method.
3. Implement its URL generation using the `SocialNetwork.url` method. If the URL can be generated by appending the username to a hostname, only update `url_dictionary`.
4. Finally, include the $\LaTeX$ icon of the social network to the `icon_dictionary` in the `CurriculumVitae.connections` method. RenderCV uses the [`fontawesome5`](https://ctan.org/pkg/fontawesome5?lang=en) package. The available icons can be seen [here](https://fosszone.csd.auth.gr/CTAN/fonts/fontawesome5/doc/fontawesome5.pdf).
Then, the tests should be implemented for the new social network with the following steps:
1. Go to `tests/test_data_models.py` and update `test_social_network_url` accordingly, i.e., add a new `(network, username, expected_url)` tuple to the `pytest.mark.parametrize` decorator.
2. Go to `tests/conftest.py` and add the new social network to `rendercv_filled_curriculum_vitae_data_model`.
3. Set `update_testdata` to `True` in `conftest.py` and run the tests to update the `testdata` folder.
4. Review the updated `testdata` folder manually to ensure everything works as expected. Then, set `update_testdata` to `False` and push the changes.

View File

@@ -0,0 +1,61 @@
# Developer Guide
All contributions to RenderCV are welcome!
The source code is thoroughly documented and well-commented, making it an enjoyable read and easy to understand. Also, a flowchart is provided below to help you understand how RenderCV works.
## Getting Started
1. Ensure that you have Python version 3.10 or higher.
2. Then, clone the repository recursively (because TinyTeX is being used as a submodule) with the following command.
```bash
git clone --recursive https://github.com/sinaatalay/rendercv.git
```
3. Go to the `rendercv` directory.
```bash
cd rendercv
```
4. Create a virtual environment.
```bash
python -m venv .venv
```
5. Activate the virtual environment.
=== "Windows (PowerShell)"
```powershell
.venv\Scripts\Activate.ps1
```
=== "MacOS/Linux"
```bash
source .venv/bin/activate
```
6. Install the dependencies.
```bash
pip install --editable .[docs,tests,dev]
```
## How RenderCV works?
The flowchart below illustrates the general operations of RenderCV. A detailed documentation of the source code is available in the [reference](../reference/index.md).
```mermaid
flowchart TD
A[YAML Input File] --parsing with ruamel.yaml package--> B(Python Dictionary)
B --validation with pydantic package--> C((Pydantic Object))
C --> D[LaTeX File]
C --> E[Markdown File]
E --markdown package--> K[HTML FIle]
D --TinyTeX--> L[PDF File]
L --PyMuPDF package--> Z[PNG Files]
AA[(Jinja2 Templates)] --> D
AA[(Jinja2 Templates)] --> E
```
## About [`pyproject.toml`](https://github.com/sinaatalay/rendercv/blob/main/pyproject.toml)
[`pyproject.toml`](https://github.com/sinaatalay/rendercv/blob/main/pyproject.toml) contains all the metadata, dependencies, and tools required for the project. Please read through the file to understand the project's technical details.

View File

@@ -0,0 +1,26 @@
# Testing
After updating the code, ensure that all tests pass. To run the tests, use the following command.
```bash
pytest
```
Once new commits are pushed to the `main` branch, the [`test.yaml`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/test.yaml) workflow will be automatically triggered, and the tests will run.
## [`testdata`](https://github.com/sinaatalay/rendercv/tree/main/tests/testdata) folder
In some of the tests:
- RenderCV generates an output with a sample input.
- Then, the output is compared with a reference output, which has been manually generated and stored in `testdata`. If the files differ, the tests fail.
When the `testdata` folder needs to be updated, it can be manually regenerated by setting `update_testdata` to `True` in `conftest.py` and running the tests.
!!! warning
- Whenever the `testdata` folder is generated, the files should be reviewed manually to ensure everything works as expected.
- `update_testdata` should be set to `False` before committing the changes.

View File

@@ -0,0 +1,45 @@
# Writing Documentation
The documentation's source files are located in the [`docs`](https://github.com/sinaatalay/rendercv/tree/main/docs) directory and it is built using the [MkDocs](https://github.com/mkdocs/mkdocs) package. To work on the documentation and see the changes in real-time, run the following command.
```bash
mkdocs serve
```
Once the changes are pushed to the `main` branch, the [`deploy-docs`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/deploy-docs.yaml) workflow will be automatically triggered, and [docs.rendercv.com](https://docs.rendercv.com/) will be updated to the most recent version.
## Updating the [`examples`](https://github.com/sinaatalay/rendercv/tree/main/examples) folder
The `examples` folder includes example YAML files for all the built-in themes, along with their corresponding PDF outputs. Also, there are PNG files of the first pages of each theme in [`docs/assets/images`](https://github.com/sinaatalay/rendercv/tree/main/docs/assets/images). These examples are shown in [`README.md`](https://github.com/sinaatalay/rendercv/blob/main/README.md).
These files are generated using [`docs/update_rendercv_files.py`](https://github.com/sinaatalay/rendercv/blob/main/docs/update_rendercv_files.py). The contents of the examples are taken from the [`get_a_sample_data_model`](https://docs.rendercv.com/reference/data_models/#rendercv.data_models.get_a_sample_data_model) function from [`data_models.py`](https://docs.rendercv.com/reference/data_models/).
Run the following command to update the `examples` folder.
```bash
python docs/update_rendercv_files.py
```
## Updating figures of the entry types in the "[Structure of the YAML Input File](https://docs.rendercv.com/user_guide/structure_of_the_yaml_input_file/)"
There are example figures for each entry type for each theme in the "[Structure of the YAML Input File](https://docs.rendercv.com/user_guide/structure_of_the_yaml_input_file/)" page.
The figures are generated using [`docs/update_rendercv_files.py`](https://github.com/sinaatalay/rendercv/blob/main/docs/update_rendercv_files.py).
Run the following command to update the figures.
```bash
python docs/update_rendercv_files.py
```
## Updating the [JSON Schema](https://github.com/sinaatalay/rendercv/blob/main/schema.json)
The schema of RenderCV's input file is defined using [Pydantic](https://docs.pydantic.dev/latest/). Pydantic allows automatic creation and customization of JSON schemas from Pydantic models.
The JSON Schema is also generated using [`docs/update_rendercv_files.py`](https://github.com/sinaatalay/rendercv/blob/main/docs/update_rendercv_files.py). It uses [`generate_json_schema`](https://docs.rendercv.com/reference/data_models/#rendercv.data_models.generate_json_schema) function from [`data_models.py`](https://docs.rendercv.com/reference/data_models/).
Run the following command to update the JSON Schema.
```bash
python docs/update_rendercv_files.py
```