Skip to content

Commit

Permalink
normalize links in JSDoc comments: (#1794)
Browse files Browse the repository at this point in the history
- use link number format
- move github/d3 to d3js.org
- add https
  • Loading branch information
Fil authored Aug 8, 2023
1 parent 7e458ff commit 090ad3a
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 54 deletions.
22 changes: 12 additions & 10 deletions src/format.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* Returns a function that formats a given month number (from 0 = January to 11
* = December) according to the specified *locale* and *format*.
*
* @param locale a [BCP 47 language tag](https://tools.ietf.org/html/bcp47);
* defaults to U.S. English.
* @param format a [month
* format](https://tc39.es/ecma402/#datetimeformat-objects): either *2-digit*,
* *numeric*, *narrow*, *short*, *long*; defaults to *short*.
* @param locale a [BCP 47 language tag][1]; defaults to U.S. English.
* @param format a [month format][2]: either *2-digit*, *numeric*, *narrow*,
* *short*, *long*; defaults to *short*.
*
* [1]: https://tools.ietf.org/html/bcp47
* [2]: https://tc39.es/ecma402/#datetimeformat-objects
*/
export function formatMonth(
locale?: string,
Expand All @@ -17,11 +18,12 @@ export function formatMonth(
* Returns a function that formats a given week day number (from 0 = Sunday to 6
* = Saturday) according to the specified *locale* and *format*.
*
* @param locale a [BCP 47 language tag](https://tools.ietf.org/html/bcp47);
* defaults to U.S. English.
* @param format a [weekday
* format](https://tc39.es/ecma402/#datetimeformat-objects): either *narrow*,
* *short*, or *long*; defaults to *short*.
* @param locale a [BCP 47 language tag][1]; defaults to U.S. English.
* @param format a [weekday format][2]: either *narrow*, *short*, or *long*;
* defaults to *short*.
*
* [1]: https://tools.ietf.org/html/bcp47
* [2]: https://tc39.es/ecma402/#datetimeformat-objects
*/
export function formatWeekday(locale?: string, format?: "long" | "short" | "narrow"): (i: number) => string;

Expand Down
4 changes: 2 additions & 2 deletions src/marks/text.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ export interface TextYOptions extends Omit<TextOptions, "x"> {
*
* [1]: https://observablehq.com/@mbostock/number-formatting
* [2]: https://observablehq.com/@mbostock/date-formatting
* [3]: https://github.com/d3/d3-format
* [4]: https://github.com/d3/d3-time-format
* [3]: https://d3js.org/d3-format
* [4]: https://d3js.org/d3-time-format
*/
export function text(data?: Data, options?: TextOptions): Text;

Expand Down
77 changes: 40 additions & 37 deletions src/plot.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export interface PlotOptions extends ScaleDefaults {

/**
* The outer width of the plot in pixels, including margins. Defaults to 640.
* On Observable, this can be set to the built-in
* [width](https://github.com/observablehq/stdlib/blob/main/README.md#width)
* for full-width responsive plots. Note: the default style has a max-width of
* 100%; the plot will automatically shrink to fit even when a fixed width is
* specified.
* On Observable, this can be set to the built-in [width][1] for full-width
* responsive plots. Note: the default style has a max-width of 100%; the plot
* will automatically shrink to fit even when a fixed width is specified.
*
* [1]: https://github.com/observablehq/stdlib/blob/main/README.md#width
*/
width?: number;

Expand Down Expand Up @@ -77,27 +77,27 @@ export interface PlotOptions extends ScaleDefaults {
/**
* Custom styles to override Plot’s defaults. Styles may be specified either
* as a string of inline styles (*e.g.*, `"color: red;"`, in the same fashion
* as assigning
* [*element*.style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style))
* or an object of properties (*e.g.*, `{color: "red"}`, in the same fashion
* as assigning [*element*.style
* properties](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration)).
* Note that unitless numbers ([quirky
* lengths](https://www.w3.org/TR/css-values-4/#deprecated-quirky-length))
* such as `{padding: 20}` may not supported by some browsers; you should
* instead specify a string with units such as `{padding: "20px"}`. By
* default, the returned plot has a white background, a max-width of 100%, and
* the system-ui font. Plot’s marks and axes default to
* [currentColor](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentcolor_keyword),
* meaning that they will inherit the surrounding content’s color. For
* example, a dark theme:
* as assigning [*element*.style][1]) or an object of properties (*e.g.*,
* `{color: "red"}`, in the same fashion as assigning [*element*.style
* properties][2]). Note that unitless numbers ([quirky lengths][3]) such as
* `{padding: 20}` may not supported by some browsers; you should instead
* specify a string with units such as `{padding: "20px"}`. By default, the
* returned plot has a white background, a max-width of 100%, and the
* system-ui font. Plot’s marks and axes default to [currentColor][4], meaning
* that they will inherit the surrounding content’s color. For example, a dark
* theme:
*
* ```js
* Plot.plot({
* style: "background: black; color: white;",
* marks: …
* })
* ```
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
* [2]: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration
* [3]: https://www.w3.org/TR/css-values-4/#deprecated-quirky-length
* [4]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentcolor_keyword
*/
style?: string | Partial<CSSStyleDeclaration> | null;

Expand All @@ -110,39 +110,41 @@ export interface PlotOptions extends ScaleDefaults {
/**
* The figure caption. If present, Plot wraps the generated SVG element in an
* HTML figure element with a figcaption, returning the figure. To specify an
* HTML caption, consider using the [`html` tagged template
* literal](http://github.com/observablehq/htl); otherwise, the specified
* string represents text that will be escaped as needed.
* HTML caption, consider using the [`html` tagged template literal][1];
* otherwise, the specified string represents text that will be escaped as
* needed.
*
* ```js
* Plot.plot({
* caption: html`Figure 1. This chart has a <i>fancy</i> caption.`,
* marks: …
* })
* ```
*
* [1]: https://github.com/observablehq/htl
*/
caption?: string | Node | null;

/**
* The [aria-label
* attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
* on the SVG root.
* The [aria-label attribute][1] on the SVG root.
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
*/
ariaLabel?: string | null;

/**
* The [aria-description
* attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description)
* on the SVG root.
* The [aria-description attribute][1] on the SVG root.
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description
*/
ariaDescription?: string | null;

/**
* The owner
* [Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) used
* to create DOM elements. Defaults to window.document, but can be changed to
* another document, say when using a virtual DOM library for server-side
* rendering in Node.
* The owner [Document][1] used to create DOM elements. Defaults to
* window.document, but can be changed to another document, say when using a
* virtual DOM library for server-side rendering in Node.
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/API/Document
*/
document?: Document;

Expand Down Expand Up @@ -184,10 +186,11 @@ export interface PlotOptions extends ScaleDefaults {
* first quartile of values has a radius of 3 pixels, but no value has a
* radius greater than 30 pixels.
*
* Plot does not currently implement a radius legend; see
* [#236](https://github.com/observablehq/plot/issues/236). We recommend
* either implementing one manually or labeling points so that values can be
* read directly from the plot.
* Plot does not currently implement a radius legend; see [#236][1]. We
* recommend either implementing one manually or labeling points so that
* values can be read directly from the plot.
*
* [1]: https://github.com/observablehq/plot/issues/236
*/
r?: ScaleOptions;

Expand Down
7 changes: 5 additions & 2 deletions src/scales.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,12 @@ export interface ScaleOptions extends ScaleDefaults {
/**
* How to format inputs (abstract values) for axis tick labels; one of:
*
* - a [d3-format](https://github.com/d3/d3-format) string for numeric scales
* - a [d3-time-format](https://github.com/d3/d3-time-format) string for temporal scales
* - a [d3-format][1] string for numeric scales
* - a [d3-time-format][2] string for temporal scales
* - a function passed a tick *value* and *index*, returning a string
*
* [1]: https://d3js.org/d3-time
* [2]: https://d3js.org/d3-time-format
*/
tickFormat?: string | ((t: any, i: number) => any) | null;

Expand Down
4 changes: 2 additions & 2 deletions src/transforms/stack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {CompareFunction, Transformed} from "./basic.js";
* *wiggle* offset is recommended for streamgraphs in conjunction with the
* *inside-out* order. For more, see [Byron & Wattenberg][1].
*
* [1]: http://leebyron.com/streamgraph/
* [1]: https://leebyron.com/streamgraph/
*/
export type StackOffsetName =
| "center"
Expand Down Expand Up @@ -53,7 +53,7 @@ export type StackOffset = StackOffsetName | StackOffsetFunction;
* The *inside-out* order is recommended for streamgraphs in conjunction with
* the *wiggle* offset. For more, see [Byron & Wattenberg][1].
*
* [1]: http://leebyron.com/streamgraph/
* [1]: https://leebyron.com/streamgraph/
*/
export type StackOrderName = "value" | "x" | "y" | "z" | "sum" | "appearance" | "inside-out";

Expand Down
4 changes: 3 additions & 1 deletion src/transforms/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import type {Map} from "./map.js";
* - *max* - the maximum value
* - *mean* - the mean (average) value
* - *median* - the median value
* - *variance* - the variance per [Welford’s algorithm](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
* - *variance* - the variance per [Welford’s algorithm][1]
* - *mode* - the mode (most common occurrence)
* - *pXX* - the percentile value, where XX is a number in [00,99]
*
* [1]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm
*/
export type WindowReducerName =
| "difference" // specific to window
Expand Down

0 comments on commit 090ad3a

Please sign in to comment.