|
| 1 | +# Contributing to the Lambda Discipline website |
| 2 | + |
| 3 | +Thanks for helping! Fixes to wording, new pages, better examples and design |
| 4 | +improvements are all welcome. By taking part you agree to follow the |
| 5 | +[Code of Conduct](CODE_OF_CONDUCT.md). |
| 6 | + |
| 7 | +This repository is the website only. Bugs in the language or the `lbd` |
| 8 | +interpreter belong in the |
| 9 | +[language repository](https://github.com/lambda-discipline/lambda-discipline/issues). |
| 10 | +Some of the site comes from there, too: |
| 11 | + |
| 12 | +* the [builtin reference](https://lambda-discipline.github.io/builtins/) is |
| 13 | + generated from `lbd docs --json`, so builtin descriptions are fixed in the |
| 14 | + `builtins!` table in the language's `src/builtins.rs`; |
| 15 | +* the [examples](https://lambda-discipline.github.io/examples/) are `.lbd` |
| 16 | + files from the language repository, so a new example goes there first and |
| 17 | + is then listed in `site.toml` here. |
| 18 | + |
| 19 | +## Reporting issues |
| 20 | + |
| 21 | +Open an issue with the matching template: a broken page or link, a mistake in |
| 22 | +the docs, or an idea for the site. Include the page URL. For security |
| 23 | +problems, see [SECURITY.md](SECURITY.md) instead. |
| 24 | + |
| 25 | +## Development setup |
| 26 | + |
| 27 | +You need Python 3.11 or newer, Git, and Rust 1.85 or newer to build `lbd`. |
| 28 | + |
| 29 | +```bash |
| 30 | +python -m venv .venv |
| 31 | +``` |
| 32 | + |
| 33 | +```bash |
| 34 | +.venv/bin/pip install -r requirements-dev.txt |
| 35 | +``` |
| 36 | + |
| 37 | +On Windows the scripts are in `.venv\Scripts\` instead of `.venv/bin/`. |
| 38 | + |
| 39 | +Build the site and preview it: |
| 40 | + |
| 41 | +```bash |
| 42 | +python build.py |
| 43 | +``` |
| 44 | + |
| 45 | +```bash |
| 46 | +python -m http.server -d _site |
| 47 | +``` |
| 48 | + |
| 49 | +`build.py` clones the language repository into `.cache/`, builds `lbd` and |
| 50 | +writes `_site/`. If you already have a checkout of the language, use it as is |
| 51 | +with `--repo ../lambda-discipline`, and skip the Cargo build with |
| 52 | +`--lbd path/to/lbd`. See [README.md](README.md) for every option and for how |
| 53 | +the repository is laid out. |
| 54 | + |
| 55 | +Optional but recommended: install the [pre-commit](https://pre-commit.com) |
| 56 | +hooks, which format and check your changes before each commit. |
| 57 | + |
| 58 | +```bash |
| 59 | +pre-commit install |
| 60 | +``` |
| 61 | + |
| 62 | +## Writing pages |
| 63 | + |
| 64 | +* Pages are Markdown in `content/`, with `title` and `description` front |
| 65 | + matter. Mark Lambda Discipline code blocks with `lbd` so they are |
| 66 | + highlighted. |
| 67 | +* Keep the tone plain and precise. Every code sample should run, and its |
| 68 | + comments should show what it really prints: check them with `lbd run`. |
| 69 | +* Link to other pages with root-relative paths such as `/reference/#types`. |
| 70 | + The link checker verifies them, including the `#fragment`. |
| 71 | + |
| 72 | +## Before you open a pull request |
| 73 | + |
| 74 | +Everything CI checks can be run locally: |
| 75 | + |
| 76 | +```bash |
| 77 | +black --check . |
| 78 | +``` |
| 79 | + |
| 80 | +```bash |
| 81 | +ruff check . |
| 82 | +``` |
| 83 | + |
| 84 | +```bash |
| 85 | +mypy |
| 86 | +``` |
| 87 | + |
| 88 | +```bash |
| 89 | +python build.py |
| 90 | +``` |
| 91 | + |
| 92 | +```bash |
| 93 | +lychee --offline --root-dir "$PWD/_site" _site |
| 94 | +``` |
| 95 | + |
| 96 | +Drop `--offline` to check external links too. Look at the pages you changed |
| 97 | +in a browser, in both light and dark mode and at phone width. |
| 98 | + |
| 99 | +## Commit messages |
| 100 | + |
| 101 | +Use `prefix: summary`, with the summary in lowercase and the imperative mood, |
| 102 | +for example `docs: explain let-polymorphism`. Common prefixes are `feat`, |
| 103 | +`fix`, `docs`, `style`, `refactor`, `ci`, `deps` and `chore`. Explain why in |
| 104 | +the body when it isn't obvious. |
0 commit comments