vuepress-plugin-md-power 1.0.0-rc.93 → 1.0.0-rc.95

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.
@@ -67,20 +67,16 @@ function runCode() {
67
67
  </p>
68
68
  <div v-if="stderr.length" class="stderr">
69
69
  <h4>Stderr:</h4>
70
- <p
70
+ <pre
71
71
  v-for="(item, index) in stderr" :key="index"
72
72
  :class="{ error: lang === 'rust' && item.startsWith('error') }"
73
- >
74
- <pre>{{ item }}</pre>
75
- </p>
73
+ >{{ item }}</pre>
76
74
  </div>
77
75
  <div v-if="stdout.length" class="stdout">
78
76
  <h4 v-if="stderr.length">
79
77
  Stdout:
80
78
  </h4>
81
- <p v-for="(item, index) in stdout" :key="index">
82
- <pre>{{ item }}</pre>
83
- </p>
79
+ <pre v-for="(item, index) in stdout" :key="index">{{ item }}</pre>
84
80
  </div>
85
81
  </div>
86
82
  </div>
@@ -214,13 +210,13 @@ function runCode() {
214
210
  font-size: 16px;
215
211
  }
216
212
 
217
- .output-content p {
213
+ .output-content pre {
218
214
  margin: 0;
219
215
  font-size: 14px;
220
216
  line-height: 20px;
221
217
  }
222
218
 
223
- .output-content p pre {
219
+ .output-content pre {
224
220
  width: fit-content;
225
221
  padding: 0 20px 0 0;
226
222
  margin: 0;
@@ -228,13 +224,13 @@ function runCode() {
228
224
  }
229
225
 
230
226
  .output-content .error,
231
- .output-content .stderr p,
232
- .output-content.rust .stderr p.error {
227
+ .output-content .stderr pre,
228
+ .output-content.rust .stderr pre.error {
233
229
  color: var(--vp-c-danger-1, #b8272c);
234
230
  transition: color var(--t-color);
235
231
  }
236
232
 
237
- .output-content.rust .stderr p {
233
+ .output-content.rust .stderr pre {
238
234
  color: var(--vp-c-text-1);
239
235
  }
240
236
 
@@ -9,14 +9,14 @@ declare function resolveCodeInfo(el: HTMLDivElement): {
9
9
  declare function useCodeRepl(el: Ref<HTMLDivElement | null>): {
10
10
  onRunCode: () => Promise<void>;
11
11
  onCleanRun: () => void;
12
- lang: Ref<Lang | undefined>;
13
- backendVersion: Ref<string>;
14
- firstRun: Ref<boolean>;
15
- stderr: Ref<string[]>;
16
- stdout: Ref<string[]>;
17
- loaded: Ref<boolean>;
18
- finished: Ref<boolean>;
19
- error: Ref<string>;
12
+ lang: Ref<Lang | undefined, Lang | undefined>;
13
+ backendVersion: Ref<string, string>;
14
+ firstRun: Ref<boolean, boolean>;
15
+ stderr: Ref<string[], string[]>;
16
+ stdout: Ref<string[], string[]>;
17
+ loaded: Ref<boolean, boolean>;
18
+ finished: Ref<boolean, boolean>;
19
+ error: Ref<string, string>;
20
20
  };
21
21
 
22
22
  export { resolveCode, resolveCodeInfo, useCodeRepl };
@@ -5,15 +5,6 @@ function useSize(options, extraHeight = 0) {
5
5
  const el = shallowRef();
6
6
  const width = computed(() => toValue(options.width) || "100%");
7
7
  const height = ref("auto");
8
- const getRadio = (ratio) => {
9
- if (typeof ratio === "string") {
10
- const [width2, height2] = ratio.split(":");
11
- const parsedRadio = Number(width2) / Number(height2);
12
- if (!Number.isNaN(parsedRadio))
13
- return parsedRadio;
14
- }
15
- return typeof ratio === "number" ? ratio : 16 / 9;
16
- };
17
8
  const getHeight = (width2) => {
18
9
  const height2 = toValue(options.height);
19
10
  const ratio = getRadio(toValue(options.ratio));
@@ -32,6 +23,15 @@ function useSize(options, extraHeight = 0) {
32
23
  });
33
24
  return { el, width, height, resize };
34
25
  }
26
+ function getRadio(ratio) {
27
+ if (typeof ratio === "string") {
28
+ const [width, height] = ratio.split(":");
29
+ const parsedRadio = Number(width) / Number(height);
30
+ if (!Number.isNaN(parsedRadio))
31
+ return parsedRadio;
32
+ }
33
+ return typeof ratio === "number" ? ratio : 16 / 9;
34
+ }
35
35
  export {
36
36
  useSize
37
37
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuepress-plugin-md-power",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.93",
4
+ "version": "1.0.0-rc.95",
5
5
  "description": "The Plugin for VuePress 2 - markdown power",
6
6
  "author": "pengzhanbo <volodymyr@foxmail.com>",
7
7
  "license": "MIT",
@@ -38,10 +38,10 @@
38
38
  "@vueuse/core": "^11.0.3",
39
39
  "markdown-it-container": "^4.0.0",
40
40
  "nanoid": "^5.0.7",
41
- "shiki": "^1.15.2",
42
- "tm-grammars": "^1.17.11",
41
+ "shiki": "^1.16.1",
42
+ "tm-grammars": "^1.17.14",
43
43
  "tm-themes": "^1.8.1",
44
- "vue": "^3.4.38"
44
+ "vue": "^3.5.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/markdown-it": "^14.1.2"