Skip to content

Commit 87f8c55

Browse files
committed
fix base url not included in db of sqlide
1 parent ba5bc25 commit 87f8c55

3 files changed

Lines changed: 39 additions & 14 deletions

File tree

.changeset/rich-houses-guess.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@hyperbook/markdown": patch
3+
"hyperbook": patch
4+
---
5+
6+
Fix missing basepath in db of sqlide

packages/markdown/src/remarkDirectiveSqlIde.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,31 @@ export default (ctx: HyperbookContext) => () => {
2323

2424
const data = node.data || (node.data = {});
2525
const attributes = node.attributes || {};
26-
const {
26+
let {
2727
id = hash(node),
28-
db = ctx.config.elements?.sqlide?.db ||
29-
ctx.makeUrl(
30-
[
31-
"directive-sqlide",
32-
"include",
33-
"assets",
34-
"databases",
35-
"world1.sqLite",
36-
],
37-
"assets",
38-
undefined,
39-
{ versioned: false },
40-
),
28+
db,
4129
height = ctx.config.elements?.sqlide?.height || "600px",
4230
} = attributes;
4331

32+
if (!db) {
33+
db = ctx.config.elements?.sqlide?.db
34+
? ctx.makeUrl(ctx.config.elements?.sqlide?.db, "public")
35+
: ctx.makeUrl(
36+
[
37+
"directive-sqlide",
38+
"include",
39+
"assets",
40+
"databases",
41+
"world1.sqLite",
42+
],
43+
"assets",
44+
undefined,
45+
{ versioned: false },
46+
);
47+
} else {
48+
db = ctx.makeUrl(db, "public", ctx.navigation.current || undefined);
49+
}
50+
4451
expectContainerDirective(node, file, name);
4552
registerDirective(
4653
file,

website/en/book/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ If you need a new feature, open an [issue](https://github.com/openpatch/hyperboo
3838
::::
3939
-->
4040

41+
## v0.89.1
42+
43+
::::tabs
44+
45+
:::tab{title="Fixed :bug:" id="fixed"}
46+
47+
- Fix issue where the base URL was not included in the SQLIDE database URL.
48+
49+
:::
50+
51+
::::
52+
4153
## v0.89.0
4254

4355
::::tabs

0 commit comments

Comments
 (0)