|
| 1 | +# Contributing to <img src="./source/_static/T4D_logo_bw.svg" alt="T4D" width="20" height="20">'s `Web Course Template` 📚 |
| 2 | + |
| 3 | +Thank you for your interest in contributing to this template! |
| 4 | + |
| 5 | +We appreciate your help in improving this template. |
| 6 | +Please follow the guidelines below to ensure a smooth contribution process. |
| 7 | + |
| 8 | +## General Guidelines 📝 |
| 9 | + |
| 10 | +- **Be Respectful**: Treat all contributors with respect and kindness. |
| 11 | + We are all here to learn and improve. |
| 12 | +- **Read the existing documentation**: Familiarize yourself with the existing content before making changes. |
| 13 | + This will also help you understand the structure and style. |
| 14 | +- **Use Clear Language**: Aim for clarity and conciseness in your writing. |
| 15 | + Avoid jargon unless you are using terms that are generally understood. |
| 16 | + |
| 17 | +## Setting Up Your Environment ⚙️ |
| 18 | + |
| 19 | +To contribute to this course, you'll need to set up your build environment 🏗️. |
| 20 | + |
| 21 | +Follow these steps: |
| 22 | + |
| 23 | +1. **Clone the Repository**: |
| 24 | + ``` |
| 25 | + git clone https://github.com/t4d-gmbh/web-course-template |
| 26 | + cd web-course-template |
| 27 | + ``` |
| 28 | +
|
| 29 | +2. **Install Dependencies**: |
| 30 | + Make sure you have Sphinx installed. |
| 31 | + You can install it, along with all ohter dependencies using pip: |
| 32 | + ```bash |
| 33 | + pip install -r requirements.txt |
| 34 | + ``` |
| 35 | + |
| 36 | +3. **Build&view the content** |
| 37 | + To build the content locally, run: |
| 38 | + ``` |
| 39 | + sphinx-build -b html source docs/html -E -A build="pages" |
| 40 | + sphinx-build -b html source docs/html/slides -E -A build="slides" |
| 41 | + ``` |
| 42 | + This will generate the HTML documentation in the `docs/html` directory. |
| 43 | + |
| 44 | + The first command will build the static html pages and the second command builds the slides 🖼️. |
| 45 | + |
| 46 | + To browse the html pages locally, open `docs/html/index.html` in your favorite browser. |
| 47 | + For the slides, open `docs/html/slides/index.html` |
| 48 | + |
| 49 | + ⚠️ Note ⚠️: The links to switch from the html pages view to the slides view are broken when locally |
| 50 | + viewing the files. |
| 51 | + |
| 52 | +## Implementing Changes 🛠️ |
| 53 | + |
| 54 | +The content is situated under `source/content` and split up into topical sub-folders. |
| 55 | +Each sub-folder should contain an `index.md` that determines which `*.md` files to include. |
| 56 | +The content from the sub-folder is then included in the main content by including its `index.md` |
| 57 | +file in the `toctree` of [`source/index.md`](./source/index.md): |
| 58 | + |
| 59 | + # source/index.md |
| 60 | + ... |
| 61 | + ```{toctree} |
| 62 | + ... |
| 63 | + content/<sub-folder>/index |
| 64 | + ``` |
| 65 | + |
| 66 | +### Slide vs. Page Content |
| 67 | + |
| 68 | +The content is rendered both as slides and as html pages. |
| 69 | +Typically, slides should contain illustrations and bullet-point like text snippets while the |
| 70 | +pages should be somewhat more self-contained. |
| 71 | + |
| 72 | +Since we do not wont to duplicate content we can create markdown files that can be rendered both |
| 73 | +as slides and included into the static view of html pages. |
| 74 | +To achieve this we render all the markdown content with `jinja` before converting it to `html` and |
| 75 | +pass a `build` context variable along that is either set to `"slides"` or `"pages"`. |
| 76 | + |
| 77 | +Following this procedure we then setup the `index.md` file in each sub(-sub)-folder as follows: |
| 78 | + |
| 79 | + |
| 80 | + {% if build == "slides" %} |
| 81 | + <!-- BUILDING THE SLIDES --> |
| 82 | + ```{toctree} |
| 83 | + :maxdepth: 2 |
| 84 | + :caption: Contents |
| 85 | + |
| 86 | + ./slide1 |
| 87 | + ./slide2 |
| 88 | + ... |
| 89 | + ``` |
| 90 | + {% else %} |
| 91 | + <!-- BUILDING THE PAGES --> |
| 92 | + ```{include} ./slide1.md |
| 93 | + ``` |
| 94 | + Maybe some extra text for the pages |
| 95 | + ```{include} ./slide2.md |
| 96 | + ``` |
| 97 | + {% endif %} |
| 98 | + |
| 99 | +This will render each slide on a separate page for the slides and build a document |
| 100 | +that includes the slides for the html page. |
| 101 | +Note that we also adapt the styling of the page depending on the value of the `build` |
| 102 | +context variable. |
| 103 | + |
| 104 | +Within each included or imported `.md` file you can also specify what content you want |
| 105 | +to show in the slides and what should be shown in the page view. |
| 106 | +You can use: |
| 107 | + |
| 108 | +- `{% if builds == 'pages' %}...{% endif %}` or `{% if page %}...{% endif %}` to include |
| 109 | + content only in the static page |
| 110 | +- `{% if builds == 'slides' %}...{% endif %}` or `{% if slide %}...{% endif %}` to include |
| 111 | + content only in the slide |
| 112 | + |
| 113 | +The above `slide1.md` could look as follows: |
| 114 | + |
| 115 | + {% if build == "slides" %} |
| 116 | + # Slide 1 title |
| 117 | + {% else %} |
| 118 | + ## Subtitle for slide 1 content |
| 119 | + {% endif %} |
| 120 | + |
| 121 | + **This text is both on the slide and in the pages |
| 122 | + {% if slide %} |
| 123 | + 🤪 This in only on the slide 🤪 |
| 124 | + {% endif %} |
| 125 | + |
| 126 | + {% if page %} |
| 127 | + This text is only in the pages view and not on the slide |
| 128 | + {% endif %} |
| 129 | + |
| 130 | + |
| 131 | +## Making Contributions ✨ |
| 132 | + |
| 133 | +Here are some ways you can contribute: |
| 134 | + |
| 135 | +- **Fixing Typos**: Simple fixes like correcting typos or grammatical errors are always welcome! |
| 136 | +- **Improving Clarity**: If you find sections that are unclear, feel free to rewrite them for better understanding. |
| 137 | +- **Adding Examples**: Examples can greatly enhance the documentation. If you have a use case, consider adding it. |
| 138 | +- **Suggest Additions**: If you think that the course is missing come curcial aspects, let us know by [creating an Issue](https://github.com/t4d-gmbh/working-with-git/issues/new). |
| 139 | + |
| 140 | +## Submitting Changes 🚀 |
| 141 | + |
| 142 | +Once you have made your changes, follow these steps to submit them: |
| 143 | + |
| 144 | +1. **Create a New Branch**: |
| 145 | + ``` |
| 146 | + git checkout -b my-feature-branch |
| 147 | + ``` |
| 148 | +
|
| 149 | +2. **Commit Your Changes**: |
| 150 | + Make sure to write clear and descriptive commit messages: |
| 151 | + ``` |
| 152 | + git commit -m "Fix typo in about git section" |
| 153 | + ``` |
| 154 | +
|
| 155 | +3. **Push to Your Fork**: |
| 156 | + ``` |
| 157 | + git push origin my-feature-branch |
| 158 | + ``` |
| 159 | +
|
| 160 | +4. **Open a Pull Request**: |
| 161 | + Go to the original repository on GitHub and open a pull request. |
| 162 | + Provide a clear description of your changes and why they are needed. |
| 163 | +
|
| 164 | +## Additional Resources 🌐 |
| 165 | +
|
| 166 | +- [Sphinx Documentation](https://www.sphinx-doc.org/en/master/) |
| 167 | +- [Markdown Guide](https://www.markdownguide.org/) |
| 168 | +- [GitHub Flow](https://guides.github.com/introduction/flow/) |
| 169 | +
|
| 170 | +Thank you for contributing! |
| 171 | +Your efforts help make our documentation better for everyone. If you have any questions, feel free to reach out to the maintainers. |
| 172 | +
|
0 commit comments