@observablehq/notebook-kit 2.5.2 → 2.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/src/runtime/index.d.ts +1 -0
- package/dist/src/runtime/index.js +1 -0
- package/dist/src/runtime/stdlib/index.d.ts +2 -1
- package/dist/src/runtime/stdlib/index.js +2 -0
- package/dist/src/runtime/stdlib/md.js +4 -2
- package/dist/src/runtime/stdlib/recommendedLibraries.d.ts +0 -1
- package/dist/src/runtime/stdlib/recommendedLibraries.js +0 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -13,6 +13,7 @@ export type * from "./stdlib/fileAttachment.js";
|
|
|
13
13
|
export { FileAttachment, requireFileRegistration, registerFile } from "./stdlib/fileAttachment.js";
|
|
14
14
|
export type * from "./stdlib/interpreter.js";
|
|
15
15
|
export { Interpreter } from "./stdlib/interpreter.js";
|
|
16
|
+
export { sql } from "./stdlib/sql.js";
|
|
16
17
|
export declare class NotebookRuntime {
|
|
17
18
|
readonly runtime: Runtime & {
|
|
18
19
|
fileAttachments: typeof fileAttachments;
|
|
@@ -8,6 +8,7 @@ export * from "./stdlib/index.js";
|
|
|
8
8
|
export { DatabaseClient } from "./stdlib/databaseClient.js";
|
|
9
9
|
export { FileAttachment, requireFileRegistration, registerFile } from "./stdlib/fileAttachment.js";
|
|
10
10
|
export { Interpreter } from "./stdlib/interpreter.js";
|
|
11
|
+
export { sql } from "./stdlib/sql.js";
|
|
11
12
|
export class NotebookRuntime {
|
|
12
13
|
constructor(builtins = library) {
|
|
13
14
|
Object.defineProperty(this, "runtime", {
|
|
@@ -6,6 +6,7 @@ import * as Generators from "./generators/index.js";
|
|
|
6
6
|
import { Interpreter } from "./interpreter.js";
|
|
7
7
|
import { Mutable } from "./mutable.js";
|
|
8
8
|
import * as Promises from "./promises/index.js";
|
|
9
|
+
import { sql } from "./sql.js";
|
|
9
10
|
export declare const root: HTMLElement;
|
|
10
11
|
export declare const library: {
|
|
11
12
|
aapl: () => Promise<any>;
|
|
@@ -40,7 +41,6 @@ export declare const library: {
|
|
|
40
41
|
Plot: () => Promise<any>;
|
|
41
42
|
React: () => Promise<any>;
|
|
42
43
|
ReactDOM: () => Promise<any>;
|
|
43
|
-
sql: () => Promise<typeof import("./sql.js").sql>;
|
|
44
44
|
tex: () => Promise<import("./template.js").RawTemplateRenderer & {
|
|
45
45
|
options: (options?: any) => import("./template.js").RawTemplateRenderer;
|
|
46
46
|
block: import("./template.js").RawTemplateRenderer;
|
|
@@ -101,4 +101,5 @@ export declare const library: {
|
|
|
101
101
|
Promises: () => typeof Promises;
|
|
102
102
|
Files: () => typeof Files;
|
|
103
103
|
DOM: () => typeof DOM;
|
|
104
|
+
sql: () => typeof sql;
|
|
104
105
|
};
|
|
@@ -8,6 +8,7 @@ import { Mutable } from "./mutable.js";
|
|
|
8
8
|
import * as Promises from "./promises/index.js";
|
|
9
9
|
import * as recommendedLibraries from "./recommendedLibraries.js";
|
|
10
10
|
import * as sampleDatasets from "./sampleDatasets.js";
|
|
11
|
+
import { sql } from "./sql.js";
|
|
11
12
|
export const root = document.querySelector("main") ?? document.body;
|
|
12
13
|
export const library = {
|
|
13
14
|
dark: () => Generators.dark(),
|
|
@@ -21,6 +22,7 @@ export const library = {
|
|
|
21
22
|
Promises: () => Promises, // deprecated!
|
|
22
23
|
Files: () => Files, // deprecated!
|
|
23
24
|
DOM: () => DOM, // deprecated!
|
|
25
|
+
sql: () => sql,
|
|
24
26
|
...recommendedLibraries,
|
|
25
27
|
...sampleDatasets
|
|
26
28
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { slugifyWithCounter } from "@sindresorhus/slugify";
|
|
2
2
|
import MarkdownIt from "markdown-it";
|
|
3
3
|
import MarkdownItAnchor from "markdown-it-anchor";
|
|
4
4
|
const mi = MarkdownIt({ html: true, linkify: true, typographer: true });
|
|
5
|
+
const slugify = slugifyWithCounter();
|
|
5
6
|
mi.use(MarkdownItAnchor, {
|
|
6
7
|
level: [2, 3],
|
|
7
|
-
slugify: (s) => slugify(s),
|
|
8
|
+
slugify: (s) => slugify(s).replace(/^(?=\d)/, "-"),
|
|
8
9
|
permalink: MarkdownItAnchor.permalink.headerLink({ class: "" })
|
|
9
10
|
});
|
|
10
11
|
export function MarkdownRenderer({ document = window.document } = {}) {
|
|
@@ -42,6 +43,7 @@ export function MarkdownRenderer({ document = window.document } = {}) {
|
|
|
42
43
|
source += template[i + 1];
|
|
43
44
|
}
|
|
44
45
|
// Render the text.
|
|
46
|
+
slugify.reset();
|
|
45
47
|
const root = document.createElement("div");
|
|
46
48
|
root.innerHTML = mi.render(source);
|
|
47
49
|
// Walk the rendered content to replace anchor placeholders.
|
|
@@ -18,7 +18,6 @@ export declare const mermaid: () => Promise<import("./template.js").AsyncRawTemp
|
|
|
18
18
|
export declare const Plot: () => Promise<any>;
|
|
19
19
|
export declare const React: () => Promise<any>;
|
|
20
20
|
export declare const ReactDOM: () => Promise<any>;
|
|
21
|
-
export declare const sql: () => Promise<typeof import("./sql.js").sql>;
|
|
22
21
|
export declare const tex: () => Promise<import("./template.js").RawTemplateRenderer & {
|
|
23
22
|
options: (options?: any) => import("./template.js").RawTemplateRenderer;
|
|
24
23
|
block: import("./template.js").RawTemplateRenderer;
|
|
@@ -18,7 +18,6 @@ export const mermaid = () => import("./mermaid.js").then((_) => _.mermaid);
|
|
|
18
18
|
export const Plot = () => import("https://cdn.jsdelivr.net/npm/@observablehq/plot/+esm");
|
|
19
19
|
export const React = () => import("https://cdn.jsdelivr.net/npm/react/+esm");
|
|
20
20
|
export const ReactDOM = () => import("https://cdn.jsdelivr.net/npm/react-dom/+esm");
|
|
21
|
-
export const sql = () => import("./sql.js").then((_) => _.sql);
|
|
22
21
|
// export const SQLite = () => import("observablehq:stdlib/sqlite").then((_) => _.default);
|
|
23
22
|
// export const SQLiteDatabaseClient = () => import("observablehq:stdlib/sqlite").then((_) => _.SQLiteDatabaseClient);
|
|
24
23
|
export const tex = () => import("./tex.js").then((_) => _.tex);
|