starlight-versions 0.5.3 → 0.5.4
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 +8 -0
- package/libs/markdown.ts +5 -3
- package/libs/versions.ts +1 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# starlight-versions
|
|
2
2
|
|
|
3
|
+
## 0.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#37](https://github.com/HiDeoo/starlight-versions/pull/37) [`7812488`](https://github.com/HiDeoo/starlight-versions/commit/7812488c665786bcfb6256cc9d3e342f9090cbcb) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fix an issue where public assets could fail to be versioned correctly.
|
|
8
|
+
|
|
9
|
+
- [#35](https://github.com/HiDeoo/starlight-versions/pull/35) [`6014403`](https://github.com/HiDeoo/starlight-versions/commit/60144036971ee871c3195bc2a6567b6aa33734b7) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue with asides using custom titles not being rendered correctly when versioned.
|
|
10
|
+
|
|
3
11
|
## 0.5.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/libs/markdown.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Image, Link, Root } from 'mdast'
|
|
|
4
4
|
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx'
|
|
5
5
|
import type { MdxjsEsm } from 'mdast-util-mdxjs-esm'
|
|
6
6
|
import { remark } from 'remark'
|
|
7
|
+
import remarkDirective from 'remark-directive'
|
|
7
8
|
import remarkFrontmatter from 'remark-frontmatter'
|
|
8
9
|
import remarkMdx from 'remark-mdx'
|
|
9
10
|
import { CONTINUE, SKIP, visit } from 'unist-util-visit'
|
|
@@ -18,7 +19,7 @@ const astroAssetRegex = /\.(png|jpg|jpeg|tiff|webp|gif|svg|avif)$/i
|
|
|
18
19
|
|
|
19
20
|
const mediaElements = new Set(['img', 'source', 'Image', 'audio', 'video'])
|
|
20
21
|
|
|
21
|
-
const processor = remark().use(remarkMdx).use(remarkFrontmatter).use(remarkStarlightVersions)
|
|
22
|
+
const processor = remark().use(remarkDirective).use(remarkMdx).use(remarkFrontmatter).use(remarkStarlightVersions)
|
|
22
23
|
|
|
23
24
|
export async function transformMarkdown(markdown: string, context: TransformContext) {
|
|
24
25
|
const file = await processor.process({
|
|
@@ -222,12 +223,12 @@ function addVersionToAstroAsset(asset: string, file: VFile) {
|
|
|
222
223
|
function addVersionToPublicAsset(asset: string, file: VFile) {
|
|
223
224
|
assert(file.data.version, 'A version must be provided to add a version to an public asset.')
|
|
224
225
|
|
|
225
|
-
const source = new URL(asset
|
|
226
|
+
const source = new URL(`.${asset}`, file.data.publicDir)
|
|
226
227
|
|
|
227
228
|
const segments = asset.split('/')
|
|
228
229
|
segments.splice(-1, 0, file.data.version.slug)
|
|
229
230
|
|
|
230
|
-
addVersionAsset(file, { source, dest: new URL(segments.join('/')
|
|
231
|
+
addVersionAsset(file, { source, dest: new URL(`.${segments.join('/')}`, file.data.publicDir) })
|
|
231
232
|
|
|
232
233
|
return segments.join('/')
|
|
233
234
|
}
|
|
@@ -248,6 +249,7 @@ export interface TransformContext {
|
|
|
248
249
|
assets: VersionAsset[]
|
|
249
250
|
base: string
|
|
250
251
|
locale: string | undefined
|
|
252
|
+
publicDir: URL
|
|
251
253
|
slug: string
|
|
252
254
|
url: URL
|
|
253
255
|
version: Version
|
package/libs/versions.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-versions",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Starlight plugin to version documentation pages.",
|
|
6
6
|
"author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"mdast-util-mdx-jsx": "^3.1.3",
|
|
26
26
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
27
27
|
"remark": "^15.0.1",
|
|
28
|
+
"remark-directive": "^4.0.0",
|
|
28
29
|
"remark-frontmatter": "^5.0.0",
|
|
29
30
|
"remark-mdx": "^3.1.0",
|
|
30
31
|
"unist-util-visit": "^5.0.0",
|