Skip to content

Commit

Permalink
1.6.0 (#1244)
Browse files Browse the repository at this point in the history
* fix #1237; null head, header, footer

* 1.6.0
  • Loading branch information
mbostock authored Apr 16, 2024
1 parent a9cbbf6 commit 529ee37
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ An array containing pages and sections. If not specified, it defaults to all Mar

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**.

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.
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.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Or with Yarn:

You should see something like this:

<pre data-copy="none"><b class="green">Observable Framework</b> v1.5.1
<pre data-copy="none"><b class="green">Observable Framework</b> v1.6.0
↳ <u><a href="http://127.0.0.1:3000/" style="color: inherit;">http://127.0.0.1:3000/</a></u></pre>

<div class="note">
Expand Down
2 changes: 1 addition & 1 deletion docs/imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Downloads from npm are cached in `.observablehq/cache/_npm` within your [source

Self-hosting of `npm:` imports applies to transitive static and [dynamic imports](#dynamic-imports). In addition to downloading modules, Framework downloads supporting files as needed for [recommended libraries](#implicit-imports) and [`import.meta.resolve`](#import-resolutions). For example, [DuckDB](./lib/duckdb) needs WebAssembly modules, and [KaTeX](./lib/tex) needs a stylesheet and fonts. For dynamic imports and `import.meta.resolve`, Framework is only able to self-host import specifiers that are static string literals.

## Node imports <a href="https://github.com/observablehq/framework/pull/1156" class="observablehq-version-badge" data-version="prerelease" title="Added in #1156"></a>
## Node imports <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>

You can import from `node_modules`. This is useful for managing dependencies with a package manager such as npm or Yarn, for importing private packages from the npm registry, or for importing from a different package registry such as GitHub.

Expand Down
2 changes: 1 addition & 1 deletion docs/lib/csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const capitals = FileAttachment("us-state-capitals.tsv").tsv({typed: true});
Inputs.table(capitals)
```

For a different delimiter, use `FileAttachment.dsv`. <a href="https://github.com/observablehq/framework/pull/1172" class="observablehq-version-badge" data-version="prerelease" title="Added in #1172"></a> For example, for semicolon separated values:
For a different delimiter, use `FileAttachment.dsv`. <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> For example, for semicolon separated values:

```js run=false
const capitals = FileAttachment("us-state-capitals.csv").dsv({delimiter: ";", typed: true});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@observablehq/framework",
"license": "ISC",
"version": "1.5.1",
"version": "1.6.0",
"type": "module",
"publishConfig": {
"access": "public"
Expand Down
16 changes: 10 additions & 6 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export interface Config {
pages: (Page | Section<Page>)[];
pager: boolean; // defaults to true
scripts: Script[]; // defaults to empty array
head: string; // defaults to empty string
header: string; // defaults to empty string
footer: string; // defaults to “Built with Observable on [date].”
head: string | null; // defaults to null
header: string | null; // defaults to null
footer: string | null; // defaults to “Built with Observable on [date].”
toc: TableOfContents;
style: null | Style; // defaults to {theme: ["light", "dark"]}
deploy: null | {workspace: string; project: string};
Expand Down Expand Up @@ -161,9 +161,9 @@ export function normalizeConfig(spec: any = {}, defaultRoot = "docs", watchPath?
if (sidebar !== undefined) sidebar = Boolean(sidebar);
pager = Boolean(pager);
scripts = Array.from(scripts, normalizeScript);
head = String(head);
header = String(header);
footer = String(footer);
head = stringOrNull(head);
header = stringOrNull(header);
footer = stringOrNull(footer);
toc = normalizeToc(toc);
deploy = deploy ? {workspace: String(deploy.workspace).replace(/^@+/, ""), project: String(deploy.project)} : null;
search = Boolean(search);
Expand Down Expand Up @@ -280,3 +280,7 @@ export function mergeStyle(
? defaultStyle
: {theme};
}

export function stringOrNull(spec: unknown): string | null {
return spec == null || spec === false ? null : String(spec);
}
6 changes: 1 addition & 5 deletions src/frontMatter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import matter from "gray-matter";
import {normalizeTheme} from "./config.js";
import {normalizeTheme, stringOrNull} from "./config.js";
import {yellow} from "./tty.js";

export interface FrontMatter {
Expand Down Expand Up @@ -49,10 +49,6 @@ export function normalizeFrontMatter(spec: any = {}): FrontMatter {
return frontMatter;
}

function stringOrNull(spec: unknown): string | null {
return spec == null || spec === false ? null : String(spec);
}

function normalizeToc(spec: unknown): {show?: boolean; label?: string} {
if (spec == null) return {show: false};
if (typeof spec !== "object") return {show: Boolean(spec)};
Expand Down

0 comments on commit 529ee37

Please sign in to comment.