@tmustier/pi-files-widget 0.2.2 → 0.2.3
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/CHANGELOG.md +5 -0
- package/file-viewer.ts +8 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this extension will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.3] - 2026-10-28
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Render Markdown with `glow` again. The viewer passed `glow` a pipe as standard input, and `glow` renders piped input in preference to its file argument, so it returned nothing and every Markdown file fell back to the raw view. Pressing `m` then appeared to do nothing, because each switch back to the rendered view fell back to raw again. Thanks to @ackalker for the report ([#111](https://github.com/tmustier/pi-extensions/issues/111)).
|
|
9
|
+
|
|
5
10
|
## [0.2.2] - 2026-10-28
|
|
6
11
|
|
|
7
12
|
### Fixed
|
package/file-viewer.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
|
2
2
|
import { execSync } from "node:child_process";
|
|
3
3
|
import { readFileSync, statSync } from "node:fs";
|
|
4
4
|
|
|
5
|
-
import { isGitRepo } from "./git";
|
|
6
|
-
import { hasCommand, isMarkdownPath, stripLeadingEmptyLines } from "./utils";
|
|
5
|
+
import { isGitRepo } from "./git.ts";
|
|
6
|
+
import { hasCommand, isMarkdownPath, stripLeadingEmptyLines } from "./utils.ts";
|
|
7
7
|
|
|
8
8
|
const DIFF_CONTENT_PREFIXES = new Set(["+", "-", " "]);
|
|
9
9
|
|
|
@@ -234,7 +234,12 @@ export function loadFileContent(
|
|
|
234
234
|
|
|
235
235
|
if (isMarkdown && renderMarkdown && hasCommand("glow")) {
|
|
236
236
|
try {
|
|
237
|
-
|
|
237
|
+
// glow renders piped standard input in preference to its file argument.
|
|
238
|
+
const output = execSync(`glow -s dark -w ${termWidth} "${filePath}"`, {
|
|
239
|
+
encoding: "utf-8",
|
|
240
|
+
timeout: 10000,
|
|
241
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
242
|
+
});
|
|
238
243
|
if (output.trim()) {
|
|
239
244
|
return { lines: stripLeadingEmptyLines(output.split("\n")), renderedMarkdown: true };
|
|
240
245
|
}
|