starlight-heading-badges 0.6.1 → 0.7.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # starlight-heading-badges
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#22](https://github.com/HiDeoo/starlight-heading-badges/pull/22) [`4a62df1`](https://github.com/HiDeoo/starlight-heading-badges/commit/4a62df184267cd83b98a1ae5770e7f7db121c5a6) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds support for Astro v6, drops support for Astro v5.
8
+
9
+ ⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now `0.38.0`.
10
+
11
+ Please follow the [upgrade guide](https://github.com/withastro/starlight/releases/tag/%40astrojs%2Fstarlight%400.38.0) to update your project.
12
+
3
13
  ## 0.6.1
4
14
 
5
15
  ### Patch Changes
package/libs/badge.ts CHANGED
@@ -22,7 +22,7 @@ export function serializeBadge(variant: Variant, text: string) {
22
22
  export function deserializeBadges(value: string): Badge[] {
23
23
  const badges: Badge[] = []
24
24
 
25
- const parts = value.split(' ').reverse()
25
+ const parts = value.split(' ').toReversed()
26
26
 
27
27
  for (const part of parts) {
28
28
  const badge = deserializeBadge(value, part)
package/libs/rehype.ts CHANGED
@@ -14,7 +14,7 @@ export function rehypeStarlightHeadingBadges() {
14
14
  const badges = deserializeBadges(node.value)
15
15
  if (badges.length === 0) return SKIP
16
16
 
17
- for (const badge of badges.reverse()) {
17
+ for (const badge of badges.toReversed()) {
18
18
  if (badge.heading) {
19
19
  node.value = badge.heading
20
20
  parent.children.splice(index + 1, 0, ...createBadgeNode(badge))
package/libs/remark.ts CHANGED
@@ -32,15 +32,13 @@ export function remarkStarlightHeadingBadges() {
32
32
  parent.data ??= {}
33
33
  parent.data.hProperties ??= {}
34
34
 
35
- if (!parent.data.hProperties['id']) {
36
- parent.data.hProperties['id'] = slugger.slug(headingText)
37
- }
35
+ parent.data.hProperties['id'] ??= slugger.slug(headingText)
38
36
  }
39
37
 
40
38
  if (node.type !== 'textDirective' || node.name !== BadgeDirectiveName) return CONTINUE
41
39
 
42
40
  const contentNode = node.children[0]
43
- if (!contentNode || contentNode.type !== 'text' || contentNode.value.length === 0) return CONTINUE
41
+ if (contentNode?.type !== 'text' || contentNode.value.length === 0) return CONTINUE
44
42
 
45
43
  let variant: Variant = 'default'
46
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starlight-heading-badges",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "license": "MIT",
5
5
  "description": "Starlight plugin to add badges to your Markdown and MDX headings.",
6
6
  "author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
@@ -15,21 +15,21 @@
15
15
  "./package.json": "./package.json"
16
16
  },
17
17
  "dependencies": {
18
- "@astrojs/markdown-remark": "^6.0.1",
18
+ "@astrojs/markdown-remark": "^7.0.0",
19
19
  "github-slugger": "^2.0.0",
20
- "mdast-util-directive": "^3.0.0",
21
- "unist-util-visit": "^5.0.0"
20
+ "mdast-util-directive": "^3.1.0",
21
+ "unist-util-visit": "^5.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@playwright/test": "^1.49.1",
24
+ "@playwright/test": "^1.58.2",
25
25
  "@types/hast": "^3.0.4",
26
26
  "@types/mdast": "^4.0.4"
27
27
  },
28
28
  "peerDependencies": {
29
- "@astrojs/starlight": ">=0.32.0"
29
+ "@astrojs/starlight": ">=0.38.0"
30
30
  },
31
31
  "engines": {
32
- "node": ">=18"
32
+ "node": ">=22.12.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"