jaamd 0.1.12 → 0.1.14
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/README.md +2 -2
- package/index.ts +11 -11
- package/package.json +1 -1
- package/src/styles/variables.css +18 -7
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ To fix it, import the stylesheet **statically** in your layout's frontmatter alo
|
|
|
62
62
|
```astro
|
|
63
63
|
---
|
|
64
64
|
// In any layout that uses MarkdownContent
|
|
65
|
-
import "jaamd/default.css";
|
|
65
|
+
import "jaamd/default.css";
|
|
66
66
|
import "jaamd/styles.css";
|
|
67
67
|
---
|
|
68
68
|
```
|
|
@@ -74,7 +74,7 @@ The duplicate import from `injectScript` is automatically deduplicated by the br
|
|
|
74
74
|
```ts
|
|
75
75
|
jaamd({
|
|
76
76
|
selector: ".jaamd-content", // CSS selector for the JS enhancements (see below)
|
|
77
|
-
theme: "
|
|
77
|
+
theme: "", // Shiki theme (default "github-light")
|
|
78
78
|
noDefault: false, // set true to skip injecting jaamd/default variable fallbacks
|
|
79
79
|
plugins: {
|
|
80
80
|
codeTabs: true, // :::code-tabs directive blocks
|
package/index.ts
CHANGED
|
@@ -13,10 +13,9 @@ export interface JaamdOptions {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Shiki syntax-highlighting theme family.
|
|
16
|
-
*
|
|
17
|
-
* @default "light"
|
|
16
|
+
* @default "github-light"
|
|
18
17
|
*/
|
|
19
|
-
theme?:
|
|
18
|
+
theme?: string;
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Skip injecting the default CSS variable fallbacks (`jaamd/default`).
|
|
@@ -48,7 +47,12 @@ export interface JaamdOptions {
|
|
|
48
47
|
* Supports `astro add jaamd`.
|
|
49
48
|
*/
|
|
50
49
|
export default function jaamd(options: JaamdOptions = {}): AstroIntegration {
|
|
51
|
-
const {
|
|
50
|
+
const {
|
|
51
|
+
selector = ".jaamd-content",
|
|
52
|
+
theme = "github-light",
|
|
53
|
+
noDefault = false,
|
|
54
|
+
plugins = {},
|
|
55
|
+
} = options;
|
|
52
56
|
const { codeTabs = true, alerts = true, directive = true } = plugins;
|
|
53
57
|
|
|
54
58
|
return {
|
|
@@ -67,14 +71,10 @@ export default function jaamd(options: JaamdOptions = {}): AstroIntegration {
|
|
|
67
71
|
const existingRemarkPlugins: any[] = existingMarkdown.remarkPlugins ?? [];
|
|
68
72
|
const existingShikiConfig: any = existingMarkdown.shikiConfig ?? {};
|
|
69
73
|
|
|
70
|
-
//
|
|
71
|
-
// only apply when the key is absent (undefined).
|
|
72
|
-
// If the user (or a prior integration) already set a key,
|
|
73
|
-
// that value is preserved as-is.
|
|
74
|
-
const shikiTheme = theme === "dark" ? "github-dark" : "github-light";
|
|
74
|
+
// `wrap` and other keys are only filled in when absent.
|
|
75
75
|
const mergedShikiConfig: any = { ...existingShikiConfig };
|
|
76
|
-
|
|
77
|
-
if (mergedShikiConfig.wrap
|
|
76
|
+
mergedShikiConfig.theme = theme;
|
|
77
|
+
if (mergedShikiConfig.wrap === undefined) mergedShikiConfig.wrap = true;
|
|
78
78
|
|
|
79
79
|
updateConfig({
|
|
80
80
|
vite: {
|
package/package.json
CHANGED
package/src/styles/variables.css
CHANGED
|
@@ -4,19 +4,29 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This file serves a dual purpose:
|
|
6
6
|
*
|
|
7
|
-
* 1. FALLBACK THEME
|
|
8
|
-
*
|
|
9
|
-
* have sensible values even if you never
|
|
10
|
-
* You can opt out with `noDefault: true`
|
|
7
|
+
* 1. FALLBACK THEME:
|
|
8
|
+
* it is automatically imported by the integration so all
|
|
9
|
+
* --jaamd-* vars have sensible values even if you never
|
|
10
|
+
* set any yourself. You can opt out with `noDefault: true`
|
|
11
|
+
* in jaamd({…}).
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* All defaults live inside @layer jaamd.defaults, so any
|
|
14
|
+
* :root rule you write outside a layer always wins — no
|
|
15
|
+
* matter the load order.
|
|
16
|
+
*
|
|
17
|
+
* 2. DOCUMENTATION:
|
|
18
|
+
* every --jaamd-* property is listed here with a comment
|
|
19
|
+
* describing its role. Copy any variable you want to override
|
|
20
|
+
* into your own :root block (no layer needed).
|
|
15
21
|
*
|
|
16
22
|
* Importable as: import "jaamd/default";
|
|
17
23
|
* @import "jaamd/default.css";
|
|
18
24
|
* ============================================================ */
|
|
19
25
|
|
|
26
|
+
/* Establish the layer so its priority is always below unlayered CSS. */
|
|
27
|
+
@layer jaamd.defaults;
|
|
28
|
+
|
|
29
|
+
@layer jaamd.defaults {
|
|
20
30
|
:root {
|
|
21
31
|
/* ── Typography ─────────────────────────────────────────── */
|
|
22
32
|
|
|
@@ -196,3 +206,4 @@
|
|
|
196
206
|
--jaamd-alert-caution-color: #cf222e;
|
|
197
207
|
--jaamd-alert-caution-bg: #ffebe9;
|
|
198
208
|
}
|
|
209
|
+
}
|