Skip to content

Commit 334f74c

Browse files
committed
Merge branch 'main' into mbostock/page-loader
2 parents c85e9cd + e8d11f7 commit 334f74c

File tree

236 files changed

+3812
-888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+3812
-888
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
docs/.observablehq/cache
3333
examples/*/docs/.observablehq/cache
3434
key: data-${{ hashFiles('docs/data/*', 'examples/*/docs/data/*') }}-${{ steps.date.outputs.date }}
35-
- if: steps.cache-data.outputs.cache-hit == 'true'
36-
run: find docs/.observablehq/cache examples/*/docs/.observablehq/cache -type f -exec touch {} +
3735
- run: yarn build
3836
- run: yarn docs:build
3937
- name: Build example "api"

docs/config.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following options are supported.
2121

2222
## root
2323

24-
The path to the source root; defaults to `docs`.
24+
The path to the source root; defaults to `src`. (Prior to <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>, the default was `docs`.)
2525

2626
## output
2727

@@ -67,9 +67,9 @@ See the [list of available themes](./themes) for more.
6767

6868
## style
6969

70-
The path to a custom stylesheet, relative to the source root. This option takes precedence over the [theme option](#theme) (if any), providing more control by allowing you to remove or alter the default stylesheet and define a custom theme.
70+
The path to a custom stylesheet, relative to the source root (typically `src`). This option takes precedence over the [theme option](#theme) (if any), providing more control by allowing you to remove or alter the default stylesheet and define a custom theme.
7171

72-
The custom stylesheet should typically import `observablehq:default.css` to build on the default styles. You can also import any of the built-in themes. For example, to create a stylesheet that builds up on the `air` theme, create a `custom-style.css` file in the `docs` folder, then set the style option to `custom-style.css`:
72+
The custom stylesheet should typically import `observablehq:default.css` to build on the default styles. You can also import any of the built-in themes. For example, to create a stylesheet that builds up on the `air` theme, create a `custom-style.css` file in the source root, then set the style option to `custom-style.css`:
7373

7474
```css
7575
@import url("observablehq:default.css");
@@ -116,7 +116,7 @@ An array containing pages and sections. If not specified, it defaults to all Mar
116116

117117
Both pages and sections have a **name**, which typically corresponds to the page’s title. The name gets displayed in the sidebar. Clicking on a page navigates to the corresponding **path**, which should start with a leading slash and be relative to the root; the path can also be specified as a full URL to navigate to an external site. Each section must specify an array of **pages**.
118118

119-
Sections may be **collapsible**. <a href="https://github.com/observablehq/framework/pull/1208" class="observablehq-version-badge" data-version="prerelease" title="Added in #1208"></a> If the **open** option is set, the **collapsible** option defaults to true; otherwise it defaults to false. If the section is not collapsible, the **open** option is ignored and the section is always open; otherwise, the **open** option defaults to true. When a section is collapsible, clicking on a section header opens or closes that section. A section will always be open if the current page belongs to that section.
119+
Sections may be **collapsible**. <a href="https://github.com/observablehq/framework/releases/tag/v1.6.0" class="observablehq-version-badge" data-version="^1.6.0" title="Added in 1.6.0"></a> If the **open** option is set, the **collapsible** option defaults to true; otherwise it defaults to false. If the section is not collapsible, the **open** option is ignored and the section is always open; otherwise, the **open** option defaults to true. When a section is collapsible, clicking on a section header opens or closes that section. A section will always be open if the current page belongs to that section.
120120

121121
For example, here **pages** specifies two sections and a total of four pages:
122122

@@ -162,16 +162,6 @@ An HTML fragment to add to the header. Defaults to the empty string.
162162

163163
An HTML fragment to add to the footer. Defaults to “Built with Observable.”
164164

165-
## scripts
166-
167-
Additional scripts to add to the head, such as for analytics. Unlike the **head** option, this allows you to reference a local script in the source root.
168-
169-
```js run=false
170-
export default {
171-
scripts: [{type: "module", async: true, src: "analytics.js"}]
172-
};
173-
```
174-
175165
## base
176166

177167
The base path when serving the site. Currently this only affects the custom 404 page, if any.
@@ -262,3 +252,15 @@ export default {
262252
markdownIt: (md) => md.use(MarkdownItFootnote)
263253
};
264254
```
255+
256+
## typographer <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
257+
258+
If true, enables simple typographic replacements in Markdown, such as replacing `(c)` with `©` and converting straight quotes to curly quotes. See also the [quotes](#quotes) option, which should be set for non-English languages if the **typographer** option is enabled. For the full list of replacements, see [markdown-it](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs). Defaults to false.
259+
260+
## quotes <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
261+
262+
The set of replacements for straight double and single quotes used when the [**typographer** option](#typographer) is enabled. Defaults to `["“", "”", "‘", "’"]` which is suitable for English. For example, you can use `["«", "»", "„", "“"]` for Russian, `["„", "“", "‚", "‘"]` for German, and `["«\xa0", "\xa0»", "‹\xa0", "\xa0›"]` for French.
263+
264+
## linkify <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
265+
266+
If true (the default), automatically convert URL-like text to links in Markdown.

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ yarn dev
1616

1717
Lastly visit <http://127.0.0.1:3000>.
1818

19-
The local preview server restarts automatically if you edit any of the TypeScript files, though you may need to reload. The default page is [docs/index.md](https://github.com/observablehq/framework/blob/main/docs/index.md?plain=1); if you edit that file and save changes, the live preview in the browser will automatically update.
19+
The local preview server restarts automatically if you edit any of the TypeScript files, though you may need to reload. The default page is [`docs/index.md`](https://github.com/observablehq/framework/blob/main/docs/index.md?plain=1); if you edit that file and save changes, the live preview in the browser will automatically update.
2020

2121
To generate the static site:
2222

docs/data/dft-road-collisions.csv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
curl -O -z docs/.observablehq/cache/dft-collisions.csv 'https://data.dft.gov.uk/road-accidents-safety-data/dft-road-casualty-statistics-collision-1979-latest-published-year.csv'
1+
test -f docs/.observablehq/cache/dft-collisions.csv || curl -o docs/.observablehq/cache/dft-collisions.csv 'https://data.dft.gov.uk/road-accidents-safety-data/dft-road-casualty-statistics-collision-1979-latest-published-year.csv'
22
duckdb -c "COPY (SELECT longitude, latitude FROM read_csv_auto('docs/.observablehq/cache/dft-collisions.csv') WHERE accident_year = 2022) TO STDOUT WITH (FORMAT CSV);"

docs/deploying.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The first time you deploy a project, you will be prompted to configure the proje
2626

2727
When the deploy command finishes, it prints a link to observablehq.cloud where you can view your deployed project. If you choose *private* as the access level, that link will only be accessible to members of your Observable workspace. (You can invite people to your workspace by going to observablehq.com.) If you chose *public*, you can share your project link with anyone. You can change the access level of a project later [from your workspace projects page](https://observablehq.com/select-workspace?next=projects).
2828

29-
<div class="note">The deploy command creates a file at <code>docs/.observablehq/deploy.json</code> with information on where to deploy the project. This file is required for automated deploys. You will need to commit this file to git to deploy via GitHub Actions. (If you have configured a source root besides <code>docs</code>, the file will be placed there instead.)</div>
29+
<div class="note">The deploy command creates a file at <code>.observablehq/deploy.json</code> under the source root (typically <code>src</code>) with information on where to deploy the project. This file is required for automated deploys. You will need to commit this file to git to deploy via GitHub Actions.</div>
3030

3131
<div class="tip">To see more available options when deploying:<pre><code class="language-sh">npm run deploy -- --help</code></pre></div>
3232

@@ -112,16 +112,14 @@ jobs:
112112
- id: cache-data
113113
uses: actions/cache@v4
114114
with:
115-
path: docs/.observablehq/cache
116-
key: data-${{ hashFiles('docs/data/*') }}-${{ steps.date.outputs.date }}
117-
- if: steps.cache-data.outputs.cache-hit == 'true'
118-
run: find docs/.observablehq/cache -type f -exec touch {} +
115+
path: src/.observablehq/cache
116+
key: data-${{ hashFiles('src/data/*') }}-${{ steps.date.outputs.date }}
119117
# ...
120118
```
121119

122120
This uses one cache per calendar day (in the `America/Los_Angeles` time zone). If you deploy multiple times in a day, the results of your data loaders will be reused on the second and subsequent runs. You can customize the `date` and `cache-data` steps to change the cadence of the caching. For example you could use `date +'%Y-%U'` to cache data for a week or `date +'%Y-%m-%dT%H` to cache it for only an hour.
123121

124-
<div class="note">You’ll need to edit the paths above if you’ve configured a source root other than <code>docs</code>.</div>
122+
<div class="note">You’ll need to edit the paths above if you’ve configured a source root other than <code>src</code>.</div>
125123

126124
## Other hosting services
127125

docs/files.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords: file, fileattachment, attachment
44

55
# Files
66

7-
Load files — whether static or generated dynamically by a [data loader](../loaders) — using the built-in `FileAttachment` function. This is available by default in Markdown, but you can import it explicitly like so:
7+
Load files — whether static or generated dynamically by a [data loader](./loaders) — using the built-in `FileAttachment` function. This is available by default in Markdown, but you can import it explicitly like so:
88

99
```js echo
1010
import {FileAttachment} from "npm:@observablehq/stdlib";
@@ -64,6 +64,7 @@ For missing files, `file.lastModified` is undefined. The `file.mimeType` is dete
6464
| [`file.arrow`][arrow] | [`Table`][arrow-table]
6565
| [`file.blob`][binary] | [`Blob`][blob]
6666
| [`file.csv`][csv] | [`Array`][array]
67+
| [`file.dsv`][csv] | [`Array`][array]
6768
| [`file.html`][markup] | [`Document`][document]
6869
| [`file.image`][media] | [`HTMLImageElement`][image]
6970
| [`file.json`][json] | [`Array`][array], [`Object`][object], _etc._
@@ -210,11 +211,11 @@ display(total);
210211

211212
## Routing
212213

213-
Attached files live in the source root (by default `docs`) alongside your Markdown pages. For example, say `index.md` has some JavaScript code that references `FileAttachment("quakes.csv")`:
214+
Attached files live in the source root (typically `src`) alongside your Markdown pages. For example, say `index.md` has some JavaScript code that references `FileAttachment("quakes.csv")`:
214215

215216
```ini
216217
.
217-
├─ docs
218+
├─ src
218219
│ ├─ index.md
219220
│ └─ quakes.csv
220221
└─ ...

0 commit comments

Comments
 (0)