Skip to content

Commit a25e280

Browse files
angularsenclaude
andauthored
Migrate GitHub wiki content to Docs/ folder (#1659)
Consolidate 16 wiki pages into Docs/ as the single source of truth, deduplicating content previously split across the wiki, CONTRIBUTING.md, and .claude/. The motivation is to make docs easier to maintain with AI agents. The key benefit of wiki is to more easily accept contributions and automatic menu navigation per page, but contributions have historically been zero and AI makes it much more efficient to manage docs. The idea is to preserve wiki pages for a while, but link replace their content with links to these files instead. New Docs/ structure: - adding-a-new-unit.md, adding-operator-overloads.md, precision.md - string-formatting.md, serialization.md, saving-to-database.md - extending-with-custom-units.md, experimental-generic-math.md, nanoframework.md - upgrading-from-{3,4,5}.x-to-{4,5,6}.x.md - collaborators/{issues-and-pull-requests,releasing-nugets,regenerate-nuget-api-key}.md - README.md (index) Other changes: - Fix backwards convention in conversion functions: prefer * for FromUnitToBaseFunc and / for FromBaseToUnitFunc (wiki had it reversed). - Merge two overlapping NuGet release wiki pages into releasing-nugets.md. - Skip Changelog wiki page (GitHub Releases is canonical) and Home (placeholder). - CONTRIBUTING.md: slim down, link to Docs/ for detailed conversion/abbreviation rules. - CLAUDE.md: add Documentation section linking to Docs/, reference adding-a-new-unit.md for conversion guidelines. - .claude/criteria-for-adding-quantities-and-units.md: reference Docs/ instead of wiki. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 60a875a commit a25e280

19 files changed

Lines changed: 1218 additions & 28 deletions

.claude/criteria-for-adding-quantities-and-units.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Criteria for adding quantities and units
22

3-
Related wiki page: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit#a-quantity-is-a-good-fit-to-add-if-it
3+
See also: [Docs/adding-a-new-unit.md](../Docs/adding-a-new-unit.md#great-but-before-you-start) for the full contributor guide.
44

55
To avoid bloating the library, we want to ensure quantities and units are widely used and well defined.
66
Avoid little used units that are obscure or too domain specific.

CLAUDE.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ The project uses a sophisticated code generation system:
5858

5959
### Adding or Modifying Units
6060
1. Edit or create JSON file in `Common/UnitDefinitions/`
61-
2. Follow conversion function guidelines:
61+
2. Follow conversion function guidelines in [Docs/adding-a-new-unit.md](Docs/adding-a-new-unit.md):
6262
- Use multiplication for `FromUnitToBaseFunc`
6363
- Use division for `FromBaseToUnitFunc`
6464
- Prefer scientific notation (1e3, 1e-5)
65+
- Use exact constituent constants instead of pre-computed decimals
6566
3. Run `generate-code.bat`
6667
4. Add tests if needed
6768

@@ -118,6 +119,15 @@ The project uses a sophisticated code generation system:
118119
- Execute: `dotnet run -c Release --project UnitsNet.Benchmark`
119120
- Results saved to `Artifacts/` folder
120121

122+
## Documentation
123+
124+
All contributor and user documentation lives in [Docs/](Docs/README.md), including:
125+
- [Adding a New Unit](Docs/adding-a-new-unit.md) — step-by-step guide with JSON schema conventions
126+
- [Adding Operator Overloads](Docs/adding-operator-overloads.md)
127+
- [Precision](Docs/precision.md) — conversion precision and test value guidelines
128+
- [Serialization](Docs/serialization.md), [String Formatting](Docs/string-formatting.md), [Saving to Database](Docs/saving-to-database.md)
129+
- [Upgrade Guides](Docs/README.md#upgrade-guides) for major version migrations
130+
121131
## Pull request reviews
122132

123133
### Adding new quantities or units

CONTRIBUTING.md

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Contributing to Units.NET
1+
# Contributing to Units.NET
22

33
Guidelines for contributing to the repo.
44
<!--markdownlint-disable MD026 -->
55
## We want your help and we are friendly to first-time contributors!
66

7-
Adding a new unit or a new quantity is easy! We have detailed the steps here and if you need any assistance we are happy to help!
7+
Adding a new unit or a new quantity is easy! See the detailed step-by-step guide:
88

9-
https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit
9+
**[Adding a New Quantity or Unit](Docs/adding-a-new-unit.md)**
1010

1111
We also want the person with the idea, suggestion or bug report to implement the change in code and get a sense of ownership for that piece of the library.
1212
This is to help grow the number of people that can contribute to the project and after someone new lands that first PR we often see more PRs from that person later.
@@ -24,19 +24,11 @@ This is to help grow the number of people that can contribute to the project and
2424
* Test method: `<method>_<condition>_<result>` (`Parse_AmbiguousUnits_ThrowsException`)
2525
* If there are many tests for a single method, you can wrap those in an inner class named the same as the method and then you can skip that part of the test method names
2626

27-
## Unit definitions (.JSON)
27+
## Unit Definitions (.JSON)
2828

2929
For a fairly complete summary of the unit definition JSON schema, see [Meter of Length](https://github.com/angularsen/UnitsNet/blob/master/Common/UnitDefinitions/Length.json). It has prefix units and multiple cultures.
3030

31-
### Conversion functions
32-
33-
Converting from unit A to B is achieved by first converting from unit A to the base unit, then from the base unit to unit B. To achieve this, each unit defines two conversion functions.
34-
35-
* Prefer multiplication for `FromUnitToBaseFunc` (`{x} * 2.54e-2` for `Inch` to `Meter`)
36-
* Prefer division for `FromBaseToUnitFunc` (`{x} / 2.54e-2` for `Meter` to `Inch`)
37-
* Prefer scientific notation `1e3` and `1e-5` instead of `1000` and `0.00001`
38-
* Prefer a constant if the conversion factor is finite (`{x} * 2.54e-2` for `Inch`)
39-
* Prefer a calculation if the conversion factor is infinite (`({x} / 72.27)*2.54e-2` for `PrinterPoint`)
31+
For detailed conventions on conversion functions, abbreviations, base dimensions, and more, see [Adding a New Unit](Docs/adding-a-new-unit.md#1-add-or-modify-json-file-for-a-quantity-class).
4032

4133
### Units
4234

@@ -46,17 +38,10 @@ Generally we try to name the units as what is the most widely used.
4638

4739
**Note:** We should really consider switching variant prefix to suffix, since that plays better with kilo, mega etc.. Currently we have units named `KilousGallon` and `KiloimperialGallon`, these would be better named `KilogallonUs` and `KilogallonImperial`.
4840

49-
### Unit abbreviations
50-
51-
A unit can have multiple abbreviations per culture/language, the first one is used by `ToString()` while all of them are used by `Parse()`.
41+
## More Documentation
5242

53-
* Prefer the most widely used abbreviation in the domain, but try to adapt to our conventions
54-
* Add other popular variants to be able to parse those too, but take care to avoid abbreviation conflicts of units of the same quantity
55-
* Use superscript (`cm²`, ``) instead of `cm^2`, `m^3`
56-
* Use `` for delta (not ``)
57-
* Use `·` for products (`N·m` instead of `Nm`, `N*m` or `N.m`)
58-
* Prefer `/` over `⁻¹`, such as `km/h` and `J/(mol·K)`
59-
* Use `h` for hours, `min` for minutes and `s` for seconds (`m` is ambiguous with meters)
60-
* Use suffixes to distinguish variants of similar units, such as `gal (U.S.)` vs `gal (imp.)` for gallons
61-
* `(U.S.)` for United States
62-
* `(imp.)` for imperial / British units
43+
See [Docs/](Docs/README.md) for the full documentation index, including:
44+
- [Precision](Docs/precision.md) — conversion precision and test guidelines
45+
- [Adding Operator Overloads](Docs/adding-operator-overloads.md)
46+
- [Serialization](Docs/serialization.md)
47+
- [Upgrade Guides](Docs/README.md#upgrade-guides)

Docs/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Units.NET Documentation
2+
3+
## Contributing
4+
5+
- [Adding a New Quantity or Unit](adding-a-new-unit.md) — step-by-step guide for adding quantities and units
6+
- [Adding Operator Overloads](adding-operator-overloads.md) — how to add strongly-typed arithmetic operators
7+
- [Precision](precision.md) — how conversions work and their precision limits
8+
9+
## Using the Library
10+
11+
- [String Formatting](string-formatting.md) — format specifiers and culture-aware output
12+
- [Serialization](serialization.md) — JSON, XML, and custom DTO serialization
13+
- [Saving to Database](saving-to-database.md) — strategies for persisting quantities
14+
- [Extending with Custom Units](extending-with-custom-units.md) — adding runtime custom quantities
15+
16+
## Platform Support
17+
18+
- [.NET nanoFramework](nanoframework.md) — embedded device support
19+
- [Experimental: Generic Math](experimental-generic-math.md) — .NET 7+ generic math interfaces
20+
21+
## Upgrade Guides
22+
23+
- [Upgrading from 3.x to 4.x](upgrading-from-3.x-to-4.x.md)
24+
- [Upgrading from 4.x to 5.x](upgrading-from-4.x-to-5.x.md)
25+
- [Upgrading from 5.x to 6.x](upgrading-from-5.x-to-6.x.md)
26+
27+
## Collaborator Guides
28+
29+
- [Issues and Pull Requests](collaborators/issues-and-pull-requests.md) — guidelines for reviewing and merging
30+
- [Releasing NuGet Packages](collaborators/releasing-nugets.md) — how to publish new versions
31+
- [Regenerate NuGet API Key](collaborators/regenerate-nuget-api-key.md) — annual key rotation
32+
33+
## Other
34+
35+
- [Top Dependencies](top-dependencies.md) — notable projects using UnitsNet

0 commit comments

Comments
 (0)