@riebeckite/plugin-breadcrumbs 0.0.5 → 0.0.7

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/README.md CHANGED
@@ -109,4 +109,8 @@ import "@riebeckite/plugin-breadcrumbs/style.css";
109
109
 
110
110
  - The trail is fixed at build time. A full rebuild always recomputes correctly.
111
111
  - Only the slug hierarchy is considered; folder ordering from frontmatter or
112
- series plugins is intentionally ignored.
112
+ series plugins is intentionally ignored.
113
+
114
+ ## See also
115
+
116
+ - [Plugin guide](../../../docs/en/plugin-system.md)
package/README_ja.md CHANGED
@@ -110,4 +110,8 @@ import "@riebeckite/plugin-breadcrumbs/style.css";
110
110
 
111
111
  - パンくず列はビルド時に確定します。再ビルドすれば常に正しく再計算されます。
112
112
  - スラッグ階層のみを参照します。frontmatter の並び順や series プラグインの
113
- 順序は意図的に考慮しません。
113
+ 順序は意図的に考慮しません。
114
+
115
+ ## ????
116
+
117
+ - [?????????](../../../docs/ja/plugin-system.md)
package/dist/index.js CHANGED
@@ -41,7 +41,8 @@ function resolveBreadcrumbsOptions(options) {
41
41
  // src/render.ts
42
42
  import {
43
43
  escapeHtml,
44
- escapeHtmlAttribute
44
+ escapeHtmlAttribute,
45
+ escapeScriptJson
45
46
  } from "@riebeckite/core";
46
47
 
47
48
  // src/url.ts
@@ -89,7 +90,7 @@ function buildBreadcrumbHeadTag(schema) {
89
90
  return {
90
91
  tag: "script",
91
92
  attrs: { type: "application/ld+json" },
92
- children: JSON.stringify(schema)
93
+ children: escapeScriptJson(JSON.stringify(schema))
93
94
  };
94
95
  }
95
96
  function hasBreadcrumbHeadTag(headTags) {
@@ -126,13 +127,14 @@ function breadcrumbs(options = {}) {
126
127
  processed.set(context.slug, context.content);
127
128
  },
128
129
  onManifestCreated: (context) => {
129
- const { manifest } = context;
130
+ const { config, manifest } = context;
131
+ if (!config) return;
130
132
  for (const entry of manifest.entries) {
131
133
  if (entry.html.includes(BREADCRUMBS_ATTRIBUTE)) continue;
132
134
  const items = buildBreadcrumbItems({
133
135
  manifest,
134
136
  entry,
135
- config: context.config,
137
+ config,
136
138
  homeLabel: resolved.homeLabel
137
139
  });
138
140
  if (items.length === 0) continue;
@@ -140,7 +142,7 @@ function breadcrumbs(options = {}) {
140
142
  const nav = renderBreadcrumbNav(items, resolved);
141
143
  html = injectBreadcrumbNav(html, nav);
142
144
  if (resolved.jsonLd) {
143
- const schema = buildBreadcrumbJsonLd(context.config, items);
145
+ const schema = buildBreadcrumbJsonLd(config, items);
144
146
  if (!hasBreadcrumbHeadTag(entry.headTags)) {
145
147
  entry.headTags = [
146
148
  ...entry.headTags ?? [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-breadcrumbs",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,11 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.5"
18
+ "@riebeckite/core": "0.0.7"
19
+ },
20
+ "devDependencies": {
21
+ "tsx": "^4.22.4",
22
+ "@riebeckite/test": "0.0.7"
19
23
  },
20
24
  "publishConfig": {
21
25
  "access": "public"
@@ -50,6 +54,7 @@
50
54
  "./style.css"
51
55
  ],
52
56
  "scripts": {
53
- "build": "node ../../../scripts/build_package.mjs"
57
+ "build": "node ../../../scripts/build_package.mjs",
58
+ "test": "node --import tsx --test \"test/*.test.ts\""
54
59
  }
55
60
  }
package/style.css CHANGED
@@ -1,39 +1,39 @@
1
- .rb-breadcrumbs {
2
- margin-block: 0 0.75rem;
3
- }
4
-
5
- .rb-breadcrumbs ol {
6
- display: flex;
7
- flex-wrap: wrap;
8
- align-items: center;
9
- gap: 0.375rem;
10
- list-style: none;
11
- margin: 0;
12
- padding: 0;
13
- }
14
-
15
- .rb-breadcrumbs__item {
16
- display: inline-flex;
17
- align-items: center;
18
- gap: 0.375rem;
19
- }
20
-
21
- .rb-breadcrumbs__link {
22
- color: var(--rb-color-muted, inherit);
23
- text-decoration: none;
24
- }
25
-
26
- .rb-breadcrumbs__link:hover {
27
- color: var(--rb-color-accent, inherit);
28
- text-decoration: underline;
29
- }
30
-
31
- .rb-breadcrumbs__current {
32
- color: var(--rb-color-ink, inherit);
33
- font-weight: 600;
34
- }
35
-
36
- .rb-breadcrumbs__separator {
37
- color: var(--rb-color-muted, inherit);
38
- opacity: 0.6;
39
- }
1
+ .rb-breadcrumbs {
2
+ margin-block: 0 0.75rem;
3
+ }
4
+
5
+ .rb-breadcrumbs ol {
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ align-items: center;
9
+ gap: 0.375rem;
10
+ list-style: none;
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ .rb-breadcrumbs__item {
16
+ display: inline-flex;
17
+ align-items: center;
18
+ gap: 0.375rem;
19
+ }
20
+
21
+ .rb-breadcrumbs__link {
22
+ color: var(--rb-color-muted, inherit);
23
+ text-decoration: none;
24
+ }
25
+
26
+ .rb-breadcrumbs__link:hover {
27
+ color: var(--rb-color-accent, inherit);
28
+ text-decoration: underline;
29
+ }
30
+
31
+ .rb-breadcrumbs__current {
32
+ color: var(--rb-color-ink, inherit);
33
+ font-weight: 600;
34
+ }
35
+
36
+ .rb-breadcrumbs__separator {
37
+ color: var(--rb-color-muted, inherit);
38
+ opacity: 0.6;
39
+ }