astro-accelerator 4.0.44 → 4.0.46

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.44",
2
+ "version": "4.0.46",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -32,19 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@astrojs/mdx": "^2.3.1",
35
- "astro": "^4.13.2",
36
- "astro-accelerator-utils": "^0.3.16",
37
- "cspell": "^8.13.2",
35
+ "astro": "^4.14.4",
36
+ "astro-accelerator-utils": "^0.3.17",
37
+ "cspell": "^8.14.2",
38
38
  "csv": "^6.3.10",
39
39
  "hast-util-from-selector": "^3.0.0",
40
40
  "html-to-text": "^9.0.5",
41
41
  "keyword-extractor": "^0.0.28",
42
42
  "optional": "^0.1.4",
43
43
  "remark-directive": "^3.0.0",
44
- "sharp": "^0.33.4"
44
+ "sharp": "^0.33.5"
45
45
  },
46
46
  "devDependencies": {
47
- "@playwright/test": "^1.46.0"
47
+ "@playwright/test": "^1.46.1"
48
48
  },
49
49
  "files": [
50
50
  ".npmrc",
@@ -15,9 +15,10 @@ type Props = {
15
15
  lang: string;
16
16
  frontmatter: Frontmatter;
17
17
  headings: { depth: number; slug: string; text: string; }[];
18
+ maxLevel?: number;
18
19
  expanded?: boolean | number;
19
20
  };
20
- const { lang, frontmatter, headings, expanded } = Astro.props satisfies Props;
21
+ let { lang, frontmatter, headings, maxLevel, expanded } = Astro.props satisfies Props;
21
22
 
22
23
  // Language
23
24
  const _ = Lang(lang);
@@ -26,6 +27,10 @@ const _ = Lang(lang);
26
27
  let openAttribute = null;
27
28
  let openInteraction = null;
28
29
 
30
+ if (maxLevel == null){
31
+ maxLevel = 3;
32
+ }
33
+
29
34
  if (typeof expanded === 'number') {
30
35
  openInteraction = expanded;
31
36
  } else if (expanded === true) {
@@ -39,7 +44,7 @@ stats.stop();
39
44
  <details open={ openAttribute } data-openon={ openInteraction }>
40
45
  <summary>{ _(Translations.toc.title) }</summary>
41
46
  <ol>
42
- {headings.map((heading) =>(
47
+ {headings.filter(h => h.depth <= maxLevel).map((heading) =>(
43
48
  <li class={ 'toc-lev-' + heading.depth }><a href={ '#' + heading.slug }>{ heading.text }</a></li>
44
49
  ))}
45
50
  </ol>