ework-web 0.10.41 → 0.10.42
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 +1 -1
- package/src/remote-file.ts +5 -4
package/package.json
CHANGED
package/src/remote-file.ts
CHANGED
|
@@ -191,17 +191,18 @@ function renderFileContent(
|
|
|
191
191
|
const ext = (rawPath.split(".").pop() || "").toLowerCase();
|
|
192
192
|
const isMd = ext === "md" || ext === "markdown";
|
|
193
193
|
const lang = extToLang(rawPath);
|
|
194
|
-
const
|
|
195
|
-
const
|
|
194
|
+
const sorted = [...data.rows].sort((a, b) => a.n - b.n);
|
|
195
|
+
const fullText = sorted.map((r) => r.t).join("\n");
|
|
196
|
+
const shownBytes = sorted.reduce((s, r) => s + r.t.length + 1, 0);
|
|
196
197
|
|
|
197
198
|
let body: string;
|
|
198
199
|
if (isMd) {
|
|
199
200
|
body = `<div class="md-render">${renderMarkdown(fullText, "")}</div>`;
|
|
200
201
|
} else if (lang && shownBytes <= 256000) {
|
|
201
|
-
const nums =
|
|
202
|
+
const nums = sorted.map((r) => r.n).join("\n");
|
|
202
203
|
body = `<div class="fv-code"><pre class="fv-gutter">${escapeHtml(nums)}</pre><pre class="fv-src"><code class="hljs language-${escapeHtml(lang)}">${hljsHighlight(fullText, lang)}</code></pre></div>`;
|
|
203
204
|
} else {
|
|
204
|
-
body = `<pre class="fv-plain"><code>${
|
|
205
|
+
body = `<pre class="fv-plain"><code>${sorted.map((r) => `<span class="ln"><span class="lnn">${r.n}</span><span class="lnc">${escapeHtml(r.t)}</span></span>`).join("")}</code></pre>`;
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
return `<!doctype html>
|