@ugoku/astro 0.1.0 → 0.1.1
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 +10 -0
- package/README.md +42 -0
- package/package.json +3 -3
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @ugoku/astro
|
|
2
|
+
|
|
3
|
+
Astro adapter for [ugoku](https://github.com/ugokujs/ugoku): runnable, editable code snippets for Shiki-highlighted fences, with no server and no DOM/iframe — console output only.
|
|
4
|
+
|
|
5
|
+
A single integration auto-wires both the `@ugoku/shiki` transformer and the page script, for plain Astro's MPA navigation and `<ClientRouter />` transitions alike. (This is for plain Astro — Astro Starlight replaces Shiki with its own highlighter and needs a separate adapter.)
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
// astro.config.mjs
|
|
11
|
+
import { defineConfig } from 'astro/config';
|
|
12
|
+
import { ugoku } from '@ugoku/astro';
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
integrations: [ugoku()],
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
That's it — no second manual step, no theme file to edit.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Add `run` or `run edit` to a fence's info string:
|
|
24
|
+
|
|
25
|
+
````md
|
|
26
|
+
```js run
|
|
27
|
+
console.log('hello');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts run edit
|
|
31
|
+
function add(a: number, b: number): number {
|
|
32
|
+
return a + b;
|
|
33
|
+
}
|
|
34
|
+
console.log(add(2, 3));
|
|
35
|
+
```
|
|
36
|
+
````
|
|
37
|
+
|
|
38
|
+
`run` is run-only; `run edit` additionally shows an editable overlay over the highlighted block, with edits persisted to `localStorage` per snippet.
|
|
39
|
+
|
|
40
|
+
TypeScript blocks (`ts`) have their type annotations stripped in-browser (no type-checking) before execution.
|
|
41
|
+
|
|
42
|
+
See the [main README](https://github.com/ugokujs/ugoku#readme) for the full picture.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ugoku/astro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"./client": "./src/client.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ugoku/core": "0.1.
|
|
21
|
-
"@ugoku/shiki": "0.1.
|
|
20
|
+
"@ugoku/core": "0.1.1",
|
|
21
|
+
"@ugoku/shiki": "0.1.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"astro": "^5.0.0"
|