@shikijs/vitepress-twoslash 1.6.0 → 1.6.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/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TransformerTwoslashOptions } from '@shikijs/twoslash/core';
2
+ import { VueSpecificOptions } from 'twoslash-vue';
2
3
  import { ShikiTransformer } from 'shiki';
3
4
  import { RendererRichOptions, TwoslashRenderer } from '@shikijs/twoslash';
4
5
  export { defaultHoverInfoProcessor } from '@shikijs/twoslash';
@@ -20,7 +21,10 @@ interface TwoslashFloatingVueRendererOptions extends RendererRichOptions {
20
21
  }
21
22
  declare function rendererFloatingVue(options?: TwoslashFloatingVueRendererOptions): TwoslashRenderer;
22
23
 
23
- interface VitePressPluginTwoslashOptions extends TransformerTwoslashOptions, TwoslashFloatingVueRendererOptions {
24
+ interface TransformerTwoslashVueOptions extends TransformerTwoslashOptions {
25
+ twoslashOptions?: TransformerTwoslashOptions['twoslashOptions'] & VueSpecificOptions;
26
+ }
27
+ interface VitePressPluginTwoslashOptions extends TransformerTwoslashVueOptions, TwoslashFloatingVueRendererOptions {
24
28
  /**
25
29
  * Requires adding `twoslash` to the code block explicitly to run twoslash
26
30
  * @default true
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TransformerTwoslashOptions } from '@shikijs/twoslash/core';
2
+ import { VueSpecificOptions } from 'twoslash-vue';
2
3
  import { ShikiTransformer } from 'shiki';
3
4
  import { RendererRichOptions, TwoslashRenderer } from '@shikijs/twoslash';
4
5
  export { defaultHoverInfoProcessor } from '@shikijs/twoslash';
@@ -20,7 +21,10 @@ interface TwoslashFloatingVueRendererOptions extends RendererRichOptions {
20
21
  }
21
22
  declare function rendererFloatingVue(options?: TwoslashFloatingVueRendererOptions): TwoslashRenderer;
22
23
 
23
- interface VitePressPluginTwoslashOptions extends TransformerTwoslashOptions, TwoslashFloatingVueRendererOptions {
24
+ interface TransformerTwoslashVueOptions extends TransformerTwoslashOptions {
25
+ twoslashOptions?: TransformerTwoslashOptions['twoslashOptions'] & VueSpecificOptions;
26
+ }
27
+ interface VitePressPluginTwoslashOptions extends TransformerTwoslashVueOptions, TwoslashFloatingVueRendererOptions {
24
28
  /**
25
29
  * Requires adding `twoslash` to the code block explicitly to run twoslash
26
30
  * @default true
package/dist/index.mjs CHANGED
@@ -145,7 +145,7 @@ function renderMarkdown(md) {
145
145
  ...this.options,
146
146
  transformers: [],
147
147
  lang,
148
- structure: "inline"
148
+ structure: node.value.trim().includes("\n") ? "classic" : "inline"
149
149
  }
150
150
  ).children
151
151
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/vitepress-twoslash",
3
3
  "type": "module",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "description": "Enable Twoslash support in VitePress",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -49,14 +49,14 @@
49
49
  ],
50
50
  "dependencies": {
51
51
  "floating-vue": "^5.2.2",
52
- "mdast-util-from-markdown": "^2.0.0",
52
+ "mdast-util-from-markdown": "^2.0.1",
53
53
  "mdast-util-gfm": "^3.0.0",
54
54
  "mdast-util-to-hast": "^13.1.0",
55
55
  "twoslash": "^0.2.6",
56
56
  "twoslash-vue": "^0.2.6",
57
57
  "vue": "^3.4.27",
58
- "@shikijs/twoslash": "1.6.0",
59
- "shiki": "1.6.0"
58
+ "@shikijs/twoslash": "1.6.1",
59
+ "shiki": "1.6.1"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "unbuild",
package/style-core.css CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  .twoslash-floating .twoslash-popup-docs,
62
62
  .twoslash-floating .twoslash-popup-error {
63
- padding: 0px 12px 0px 12px !important;
63
+ padding: 12px !important;
64
64
  font-family: var(--twoslash-docs-font);
65
65
  font-size: 0.9em;
66
66
  max-height: 500px;
@@ -70,6 +70,16 @@
70
70
  text-wrap: balance;
71
71
  }
72
72
 
73
+ .twoslash-floating .twoslash-popup-docs p:first-child,
74
+ .twoslash-floating .twoslash-popup-error p:first-child {
75
+ margin-top: 0;
76
+ }
77
+
78
+ .twoslash-floating .twoslash-popup-docs p:last-child,
79
+ .twoslash-floating .twoslash-popup-error p:last-child {
80
+ margin-bottom: 0;
81
+ }
82
+
73
83
  .twoslash-floating .twoslash-popup-docs {
74
84
  border-top: 1px solid var(--twoslash-border-color);
75
85
  color: var(--twoslash-docs-color);
@@ -85,8 +95,7 @@
85
95
 
86
96
  .twoslash-floating .twoslash-popup-docs p,
87
97
  .twoslash-floating .twoslash-popup-error p {
88
- margin: 0;
89
- padding: 6px 0;
98
+ margin: 6px 0;
90
99
  text-wrap: balance;
91
100
  }
92
101
 
package/style.css CHANGED
@@ -348,7 +348,7 @@
348
348
 
349
349
  .twoslash-floating .twoslash-popup-docs,
350
350
  .twoslash-floating .twoslash-popup-error {
351
- padding: 0px 12px 0px 12px !important;
351
+ padding: 12px !important;
352
352
  font-family: var(--twoslash-docs-font);
353
353
  font-size: 0.9em;
354
354
  max-height: 500px;
@@ -358,6 +358,16 @@
358
358
  text-wrap: balance;
359
359
  }
360
360
 
361
+ .twoslash-floating .twoslash-popup-docs p:first-child,
362
+ .twoslash-floating .twoslash-popup-error p:first-child {
363
+ margin-top: 0;
364
+ }
365
+
366
+ .twoslash-floating .twoslash-popup-docs p:last-child,
367
+ .twoslash-floating .twoslash-popup-error p:last-child {
368
+ margin-bottom: 0;
369
+ }
370
+
361
371
  .twoslash-floating .twoslash-popup-docs {
362
372
  border-top: 1px solid var(--twoslash-border-color);
363
373
  color: var(--twoslash-docs-color);
@@ -373,8 +383,7 @@
373
383
 
374
384
  .twoslash-floating .twoslash-popup-docs p,
375
385
  .twoslash-floating .twoslash-popup-error p {
376
- margin: 0;
377
- padding: 6px 0;
386
+ margin: 6px 0;
378
387
  text-wrap: balance;
379
388
  }
380
389