-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add contributing guidelines #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
T0mstone
wants to merge
24
commits into
typst:main
Choose a base branch
from
T0mstone:conventions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bcd5486
Add conventions document
T0mstone 8cb3299
Implement suggestions
T0mstone baf9042
Implement suggestions (Part 2)
T0mstone 4f204e9
Fix and improve formatting
T0mstone 677e67f
Change formatting again
T0mstone b6fc5d6
Add last missing example
T0mstone 67550cf
Reformat slightly and add intro paragraph
T0mstone ceafd2e
Add paragraph for newcomers
T0mstone 4262c65
Add note about symbol name length
T0mstone 10d2545
Add note about diagonals
T0mstone 1d6e351
Re-order modifiers
T0mstone 49d8d1b
Fix Typst capitalization
T0mstone d23d15d
Fix typo
T0mstone a8a9bd4
Add note about US spelling
T0mstone fbfe9de
Rephrase proposals paragraph
T0mstone 0a8c1a2
Implement simple suggestions
T0mstone 30b10be
Add explanation of terms
T0mstone cd5a07b
Add PR section
T0mstone 81a7c30
Shuffle dots around
T0mstone ba7dde4
Use spaces for indentation
T0mstone e6e1312
two-headed → bidirectional
MDLC01 2c846fd
main → top-level
T0mstone 12d19aa
Elaborate on the fallback mechanism
T0mstone 82c392f
for for
T0mstone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Contributing Guidelines | ||
| Contributions are welcome! This document provides some resources and guidelines to help with the process. | ||
|
|
||
| Codex collects related Unicode symbols as different *variants* of the same *symbol*.[^symbol] | ||
| For example, `→ ⇒ ↑ ⇑` are four variants of the `arrow` symbol. | ||
| Each symbol has a default variant (here `→`). | ||
| To refer to a particular variant, *modifiers* can be appended to the symbol name | ||
| using dot separators. | ||
| For example `⇒` is `arrow.r.double`, `↑` is `arrow.t` and `⇑` is `arrow.t.double`. | ||
| Modifiers are order-independent, so the latter can also be referred to as `arrow.double.t`. | ||
| Additionally, not all modifiers have to be specified, in which case the best match[^match] | ||
| will be taken. For example, `⇒` can also be referred to as `arrow.double`. | ||
| Groups of related symbols are collected into *modules*. Modules can also contain other modules. | ||
| Codex exports two top-level modules: `sym` for text-style symbols and `emoji` for emoji; | ||
| Their source code is found in `src/modules/`. | ||
|
|
||
| If you need help with a contribution, you can also ask us [on Discord](https://discord.com/channels/1054443721975922748/1277628305142452306). | ||
|
|
||
| Proposals used to be written in a dedicated Proposals document, | ||
| but new proposals should now be filed as GitHub issues instead. | ||
| The [document](https://typst.app/project/riXtMSim5zLCo7DWngIFbT) | ||
| has been repurposed to serve as a collection of useful information | ||
| and naming ideas. | ||
|
|
||
| [^symbol]: This document also uses "symbol" in the more abstract sense of a graphical symbol. | ||
| [^match]: See the documentation of `ModifierSet::best_match_in` for the exact details. | ||
|
|
||
| ## Pull Requests | ||
| - All PRs require two approvals by collaborators to be merged. | ||
| - PRs with breaking changes require three such approvals instead. | ||
| - PRs with changes to the public Rust API also require an approval by @laurmaedje. | ||
|
|
||
| To remove a symbol or variant, it is first marked as deprecated | ||
| (This is considered a breaking change). | ||
| After a Typst version that includes this deprecation notice has been released, | ||
| the deprecated symbol or variant will be removed (This is not considered a breaking change). | ||
| Instead of being removed, the name can also be repurposed for a different symbol, | ||
| which can be seen as a combination of removing the old symbol or variant | ||
| and adding a new one with the same name. | ||
|
|
||
| ## Conventions | ||
| When adding new modules, symbols or variants, please try to be consistent with | ||
| existing ones. Below are some guidelines based on existing symbols. These aren't | ||
| always hard rules, especially because of how messy Unicode can be, but you should | ||
| adhere to them if possible. | ||
|
|
||
| ### General Conventions | ||
| - English words use US spelling. | ||
| - Modifier and module names are entirely lowercase. | ||
| - Symbol names are lowercase unless the symbol is an uppercase letter. | ||
| - Symbol names should be at least two characters long so they can be used easily in Typst's math mode. | ||
| - When a symbol is added to a base, the symbol name is used as a modifier on the base.[^modifname] | ||
T0mstone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| This can have the following meanings: | ||
| 1. The symbol is added around or inside the base as a subordinate (smaller than the base), | ||
| e.g. `eq.quest`, `triangle.stroked.dot`. | ||
| 2. The symbol is stacked below the base, e.g. `gt.lt`. | ||
| 3. The symbol is stacked to the right of the base, e.g. `colon.eq`. | ||
| 4. The symbol is overlaid at the center of the base, e.g. `integral.dash`. | ||
| 5. The symbol surrounds the base, e.g. `plus.square`. | ||
| - Notable exceptions to the previous convention: | ||
| - When `.eq` is used in the second sense (stacked below), it only adds a single line and not two, | ||
| e.g. `lt.eq`. For two lines below, `.equiv` is used, e.g. `lt.equiv`. | ||
|
|
||
| [^modifname]: Though a modifier can also just coincidentally be a symbol name, e.g. `.not`. | ||
|
|
||
| ### Established Generic Modifiers | ||
| These have a broad meaning and can have varying interpretations. | ||
| <!-- Geometry --> | ||
| - `.l`/`.r`/`.t`/`.b`: The four main directions (left/right/top/bottom), e.g. `arrow.l`, `times.r`. | ||
| - For delimiters, `.l` means opening and `.r` means closing, e.g. `paren.l`, `quote.r`. | ||
| - `.tl`/`.tr`/`.bl`/`.br`: The four corners, e.g. `arrow.tl`, `triangle.stroked.tr`. | ||
| - Generally, these are used for a single, diagonal direction, | ||
| whereas combinations of two main directions (like `.t.l`) are used to mean both of them at once, | ||
| e.g. `arrow.t.l`, if it existed, would be a bidirectional arrow that points both top and left, | ||
| similarly to how `arrow.l.r` is an arrow pointing both left and right. | ||
| - `.cw`/`.ccw`: Clockwise/Counterclockwise, e.g. `arrow.cw`, `integral.ccw`. | ||
| - `.tiny`/`.small`/`.medium`/`.big`: A geometric shape with a certain size, e.g. `square.stroked.small`. | ||
| <!-- Strokes --> | ||
| - `.stroked`/`.filled`: A symbol that has an empty/filled interior, e.g. `circle.stroked`, `arrow.r.filled`. | ||
| (They correspond to Unicode's "white"/"black".) | ||
| - `.dotted`: A shape with a dotted line instead of a full stroke, e.g. `circle.dotted`. | ||
| - `.light`/`.heavy`: A shape with a certain stroke weight, e.g. `checkmark.heavy`. | ||
| <!-- Other (in alphabetic order) --> | ||
| - `.alt`: An alternate glyph for the symbol, e.g. `phi.alt`. | ||
| - `.double`, `.triple`, `.quad`: A symbol that has 2-4 of something, e.g. `excl.double`, `eq.quad`. | ||
|
|
||
| ### Established Concrete Modifiers | ||
| These have a specific meaning that is not open to much interpretation. | ||
| <!-- (in alphabetic order) --> | ||
| - `.big`: A [large](https://www.unicode.org/Public/math/latest/MathClassEx-15.html) (n-ary) version | ||
| of an operator, e.g. `union.big`. | ||
| - `.inv`: Either vertically mirrored or a 180° rotated version of a symbol, e.g. `amp.inv`, `Omega.inv`. | ||
| - See also [#108](https://github.com/typst/codex/issues/108). | ||
| - `.not`: A negation of the symbol, e.g. `eq.not`. | ||
| - `.o`: A symbol with a circle around it, e.g. `plus.circle`. | ||
| - See also [#62](https://github.com/typst/codex/pull/62) | ||
| - `.rev`: A horizontally mirrored version of a symbol, e.g. `in.rev`. | ||
| - See also [#108](https://github.com/typst/codex/issues/108). | ||
| - `.sq`: A "squarified" version of a symbol, e.g. `subset.sq`. | ||
| - See also [#110](https://github.com/typst/codex/pull/110) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.