@berlysia/vertical-writing-slide-system 0.0.23 → 0.0.25

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": "@berlysia/vertical-writing-slide-system",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vertical-slides": "./cli.js"
package/src/index.css CHANGED
@@ -65,6 +65,21 @@ code {
65
65
  margin: 0;
66
66
  margin-block-end: 0.2em;
67
67
  }
68
+
69
+ h2 {
70
+ font-size: 1.2em;
71
+ font-weight: bold;
72
+ margin: 0;
73
+ margin-block-end: 0.2em;
74
+ }
75
+
76
+ h3 {
77
+ font-size: 1em;
78
+ font-weight: bold;
79
+ margin: 0;
80
+ margin-block-end: 0.2em;
81
+ }
82
+
68
83
  ul,
69
84
  ol {
70
85
  list-style-position: outside;
@@ -319,7 +319,33 @@ export default async function slidesPlugin(
319
319
  slideScripts.external.push(...extractedScripts.external);
320
320
  slideScripts.inline.push(...extractedScripts.inline);
321
321
 
322
- return `export default ${JSON.stringify(processedSlides.map((p) => p.value))}`;
322
+ // スライド固有のスクリプトを文字列として生成
323
+ const slideScriptsString = JSON.stringify(slideScripts);
324
+
325
+ // スライド固有のCSSを文字列として生成
326
+ const slideStylesString =
327
+ slideStyles.length > 0
328
+ ? JSON.stringify(slideStyles.join("\n\n"))
329
+ : "null";
330
+
331
+ return `
332
+ // スライド固有のCSSを注入
333
+ const slideStyles = ${slideStylesString};
334
+ if (slideStyles && typeof document !== 'undefined') {
335
+ const existingStyleElement = document.getElementById('slide-custom-styles');
336
+ if (existingStyleElement) {
337
+ existingStyleElement.textContent = slideStyles;
338
+ } else {
339
+ const styleElement = document.createElement('style');
340
+ styleElement.id = 'slide-custom-styles';
341
+ styleElement.textContent = slideStyles;
342
+ document.head.appendChild(styleElement);
343
+ }
344
+ }
345
+
346
+ export default ${JSON.stringify(processedSlides.map((p) => p.value))};
347
+ export const slideScripts = ${slideScriptsString};
348
+ `;
323
349
  }
324
350
 
325
351
  const slides = content.split(/^\s*(?:---|\*\*\*|___)\s*$/m);