@f5-sales-demo/docs-theme 4.4.6 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f5-sales-demo/docs-theme",
3
- "version": "4.4.6",
3
+ "version": "4.4.7",
4
4
  "description": "F5 Distributed Cloud branded Starlight documentation theme",
5
5
  "type": "module",
6
6
  "engines": {
@@ -30,7 +30,10 @@ export async function shareProviderAssets(root, base = '/') {
30
30
  tokenStyles.set(name, style);
31
31
  return `<span class="${name}"`;
32
32
  });
33
- html = html.replace(/href="https:\/\/f5-sales-demo.github.io(\/terraform-provider-xcsh\/[^"#]*)/g, 'href="$1');
33
+ html = html.replace(
34
+ /<a\b([^>]*?)href="https:\/\/f5-sales-demo.github.io(\/terraform-provider-xcsh\/[^"#]*)/g,
35
+ '<a$1href="$2',
36
+ );
34
37
  if (tokenStyles.size) html = html.replace('</head>', `<link rel="stylesheet" href="${prefix}tokens.css"></head>`);
35
38
  const islands = [];
36
39
  html = html.replace(/<astro-island\b[\s\S]*?<\/astro-island>/g, (island) => {
@@ -71,3 +71,17 @@ it('resolves file-route links from their containing directory', async () => {
71
71
  await rm(root, { recursive: true, force: true });
72
72
  }
73
73
  });
74
+
75
+ it('preserves absolute canonical metadata while shortening anchor links', async () => {
76
+ const root = await mkdtemp(join(tmpdir(), 'provider-canonical-'));
77
+ try {
78
+ const url = 'https://f5-sales-demo.github.io/terraform-provider-xcsh/resources/';
79
+ await writeFile(join(root, 'index.html'), `<link rel="canonical" href="${url}"><a href="${url}">Resources</a>`);
80
+ await shareProviderAssets(root, '/terraform-provider-xcsh/');
81
+ const html = await readFile(join(root, 'index.html'), 'utf8');
82
+ expect(html).toContain(`<link rel="canonical" href="${url}">`);
83
+ expect(html).toContain('<a href="resources/">');
84
+ } finally {
85
+ await rm(root, { recursive: true, force: true });
86
+ }
87
+ });