heyq02 0.2.6 → 0.2.7
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/cli.js +2 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Marked } from "marked";
|
|
|
3
3
|
import { markedTerminal } from "marked-terminal";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
|
-
var version = "0.2.
|
|
6
|
+
var version = "0.2.7";
|
|
7
7
|
|
|
8
8
|
// src/readme.ts
|
|
9
9
|
const README_URL = "https://raw.githubusercontent.com/heyq02/heyq02/main/README.md";
|
|
@@ -12,12 +12,6 @@ function errorText(error) {
|
|
|
12
12
|
return error instanceof Error ? error.message : String(error);
|
|
13
13
|
}
|
|
14
14
|
const marked = new Marked(markedTerminal());
|
|
15
|
-
function previewSource(markdown) {
|
|
16
|
-
return markdown.replaceAll(/<h1>([\s\S]*?)<\/h1>/gi, (_, text) => `# ${text.trim()}`).replaceAll(/<picture>[\s\S]*?<\/picture>/gi, (block) => {
|
|
17
|
-
const alt = /alt="([^"]*)"/.exec(block)?.[1];
|
|
18
|
-
return alt ? `\n${alt}\n` : "";
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
15
|
async function fetchReadme(fetchImpl = globalThis.fetch, url = README_URL) {
|
|
22
16
|
let response;
|
|
23
17
|
try {
|
|
@@ -29,7 +23,7 @@ async function fetchReadme(fetchImpl = globalThis.fetch, url = README_URL) {
|
|
|
29
23
|
return response.text();
|
|
30
24
|
}
|
|
31
25
|
async function renderPreview(markdown) {
|
|
32
|
-
return `${(await marked.parse(
|
|
26
|
+
return `${(await marked.parse(markdown)).trimEnd()}\n`;
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
// src/main.ts
|