From 35eee07c6752025bcedf8f748fbb48d75d5d6750 Mon Sep 17 00:00:00 2001 From: Jonah Scheinerman Date: Sun, 7 Apr 2019 18:27:31 -0400 Subject: [PATCH] Docs feedback (#121) --- docs/defining-quantities.md | 2 +- docs/generic-measures.md | 6 +++--- docs/index.md | 4 ++-- docsgen/markdown.tsx | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/defining-quantities.md b/docs/defining-quantities.md index 48a3e7b..244aee3 100644 --- a/docs/defining-quantities.md +++ b/docs/defining-quantities.md @@ -106,4 +106,4 @@ const Velocity = Length.over(Time); type Velocity = LiftMeasure; ``` -This way, we can use `Velocity` to refer to the quantity on numbers, but also use `Velocity` to operate on `WrappedMeasure`s. \ No newline at end of file +This way, we can use `Velocity` to refer to the quantity on numbers, but also use `Velocity` to operate on `WrappedMeasure` types. \ No newline at end of file diff --git a/docs/generic-measures.md b/docs/generic-measures.md index 7c324d0..cc3208e 100644 --- a/docs/generic-measures.md +++ b/docs/generic-measures.md @@ -18,7 +18,7 @@ function wrap(value: number) { } ``` -Now we're going to create our own measure type that operates on `WrappedNumber`s, let's call it `WrappedMeasure`: +Now we're going to create our own measure type that operates on `WrappedNumber` types, let's call it `WrappedMeasure`: ```ts import { createMeasureType, GenericMeasure, Unit } from "safe-units"; @@ -61,11 +61,11 @@ After we've defined the type of `WrappedMeasure` we now define the class itself ## Usage -The returned `WrappedMeasure` now behaves just like `Measure` does except in the domain of wrapped numbers. This means we can call `WrappedMeasure.dimension` or `WrappedMeasure.of` just as expected. It's important to note that the provided quantities and units (`Length`, `Time`, `meters`, `seconds`, etc) will need to be redefined for other measure types as these types are all specific to `number`s. +The returned `WrappedMeasure` now behaves just like `Measure` does except in the domain of wrapped numbers. This means we can call `WrappedMeasure.dimension` or `WrappedMeasure.of` just as expected. It's important to note that the provided quantities and units (`Length`, `Time`, `meters`, `seconds`, etc) will need to be redefined for other measure types as these types are all specific to `number`. ## Static Methods -By default, generic measures come with a set of static methods that can be applied to measures of all numeric types. However, certain static methods may only make sense for a given numeric type. For example the `Measure.trunc` method exists because `Math.trunc` applies to `number`s. To add static methods to a generic measure type, simple pass an object as a second argument to `createMeasureType`: +By default, generic measures come with a set of static methods that can be applied to measures of all numeric types. However, certain static methods may only make sense for a given numeric type. For example the `Measure.trunc` method exists because `Math.trunc` applies to `number` types. To add static methods to a generic measure type, simple pass an object as a second argument to `createMeasureType`: ```ts declare function foo(value: WrappedNumber): WrappedNumber; diff --git a/docs/index.md b/docs/index.md index 52f0a6e..8a5e717 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,8 +21,8 @@ const error: Velocity = length.times(time); Safe units is written in TypeScript and should be consumed by TypeScript users to take full advantage of what it provides. In addition you will need the following: -- TypeScript 2.9 or later -- Strict null checks enabled for your project +- [TypeScript](http://www.typescriptlang.org/) 2.9 or later +- [Strict null checks](https://www.typescriptlang.org/docs/handbook/compiler-options.html) enabled for your project ## Installation diff --git a/docsgen/markdown.tsx b/docsgen/markdown.tsx index fe9a7e0..aace4f3 100644 --- a/docsgen/markdown.tsx +++ b/docsgen/markdown.tsx @@ -146,10 +146,11 @@ const CodeInline = component("code-line", "code", { }); export const Link = component("link", "a", { - color: "#00B3A4", + color: "#BF8C0A", textDecoration: "none", $nest: { "&:hover": { + color: "#A67908", textDecoration: "underline", }, },