@jaxzhou/dsh-file-explorer 0.1.4 → 0.1.5

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/README.md CHANGED
@@ -44,8 +44,8 @@ The right pane picks each tab's body from the file:
44
44
 
45
45
  | Category | Preview |
46
46
  |---|---|
47
- | **Markdown** | Rendered GFM — headings, tables, task lists, quotes, math, footnotes, images referenced beside the file, highlighted code fences — with a **Source** toggle, and **Export PDF** |
48
- | **HTML** | Drawn as a page in a sandboxed frame: the file's own CSS applies, and its scripts run in an opaque origin that cannot reach this application. With a **Source** toggle, and **Export PDF** |
47
+ | **Markdown** | Rendered GFM — headings, tables, task lists, quotes, math, footnotes, images referenced beside the file, highlighted code fences — with a **Source** toggle and an **Export** menu |
48
+ | **HTML** | Drawn as a page in a sandboxed frame: the file's own CSS applies, and its scripts run in an opaque origin that cannot reach this application. With a **Source** toggle and an **Export** menu |
49
49
  | **JSON** | A collapsible tree with per-value copy, and the same toggle |
50
50
  | **Source code** | Syntax highlighting, line numbers, and a copy button for 24 grammars: TypeScript/JavaScript, shell, Python, Ruby, Go, Rust, Java, C, C++, C#, Kotlin, Swift, PHP, YAML, TOML, INI, HTML, CSS, SCSS, Less, SQL, XML, Lua, MDX |
51
51
  | **Images** | PNG, JPEG, GIF, WebP, AVIF, BMP, ICO and SVG, drawn to the pane. An SVG goes through `<img>`, so its scripts never run |
@@ -54,10 +54,18 @@ The right pane picks each tab's body from the file:
54
54
  Text previews wrap at their spaces and keep every word whole; an image reads its
55
55
  complete bytes. Every text body carries a **Copy** control in the pane's toolbar,
56
56
  which copies the file's own text — a rendered Markdown document copies its
57
- Markdown source. A rendered Markdown or HTML file also carries **Export PDF**,
58
- which hands the page to the browser's print dialog: every browser offers "Save as
59
- PDF" there, and its own layout engine keeps the text as text rather than
60
- rasterising the page the way a canvas-based PDF library would.
57
+ Markdown source.
58
+
59
+ A rendered Markdown or HTML document also carries **Export**, which **downloads a
60
+ file directly** — no print dialog — in either of two formats:
61
+
62
+ | Format | What it is |
63
+ |---|---|
64
+ | **PDF** | A picture of the page, laid out as A4 and sliced to fit. The text in it is not selectable. That is deliberate: a text-mode PDF of a Chinese document would need a CJK font embedded in the plugin, which is megabytes for a preview tool |
65
+ | **Word** (`.docx`) | A real Word document: headings, lists, tables, code and images, with the text still text — editable, searchable, and rendered with Word's own fonts. Chinese included |
66
+
67
+ A document's own local assets come with it: the images a Markdown file references
68
+ beside it, and the images and stylesheets an HTML file links to.
61
69
 
62
70
  ## Requirements
63
71
 
@@ -147,8 +155,13 @@ restart the profile.
147
155
  the second loads directly, and the third is not fetched.
148
156
  - **HTML previews do not resolve relative assets.** A page drawn from a Blob
149
157
  document has no base to resolve its own `style.css` or images against, so only
150
- absolute URLs load there too. An export prints the page as it renders without
151
- its scripts, which a static PDF has no use for anyway.
158
+ absolute URLs load there. **An export does resolve them** — the file it writes is
159
+ read from a copy that has been made to stand alone — so a document can export
160
+ with pictures it does not show in the preview.
161
+ - **A PDF's text is a picture.** Nothing in it can be selected or searched. Export
162
+ Word instead when the text has to stay text.
163
+ - **Long documents are cut at 60 PDF pages**, and an image past 8 MiB is left out;
164
+ both are stated here because a silent cut reads as a complete export.
152
165
 
153
166
  ## Contributing
154
167
 
package/README.zh.md CHANGED
@@ -39,8 +39,8 @@ dsh --profile web
39
39
 
40
40
  | 类别 | 预览 |
41
41
  |---|---|
42
- | **Markdown** | 直接渲染为 GFM —— 标题、表格、任务列表、引用、公式、脚注、引用文件旁的图片、高亮的代码围栏 —— 并带 **源码** 切换与 **导出 PDF** |
43
- | **HTML** | 在沙箱 iframe 中当作页面绘制:文件自己的 CSS 生效,其脚本运行在不透明源(opaque origin)里,无法触达本应用。带 **源码** 切换与 **导出 PDF** |
42
+ | **Markdown** | 直接渲染为 GFM —— 标题、表格、任务列表、引用、公式、脚注、引用文件旁的图片、高亮的代码围栏 —— 并带 **源码** 切换与 **导出** 菜单 |
43
+ | **HTML** | 在沙箱 iframe 中当作页面绘制:文件自己的 CSS 生效,其脚本运行在不透明源(opaque origin)里,无法触达本应用。带 **源码** 切换与 **导出** 菜单 |
44
44
  | **JSON** | 可折叠树,每个值可单独复制,同样带 **源码** 切换 |
45
45
  | **源码** | 24 种语法的语法高亮、行号与复制按钮:TypeScript/JavaScript、shell、Python、Ruby、Go、Rust、Java、C、C++、C#、Kotlin、Swift、PHP、YAML、TOML、INI、HTML、CSS、SCSS、Less、SQL、XML、Lua、MDX |
46
46
  | **图片** | PNG、JPEG、GIF、WebP、AVIF、BMP、ICO、SVG,自动适配窗格。SVG 经 `<img>` 绘制,其中的脚本不会执行 |
@@ -48,9 +48,18 @@ dsh --profile web
48
48
 
49
49
  文本预览在空格处折行、保持单词完整;图片读取完整字节。每一种文本预览在窗格工具栏
50
50
  里都有 **复制** 按钮,复制的是文件自身的文本——渲染态的 Markdown 复制的是它的
51
- Markdown 源码。渲染态的 Markdown 与 HTML 还带 **导出 PDF**:它把页面交给浏览器的
52
- 打印对话框,那里每个浏览器都提供「另存为 PDF」,而排版由浏览器自己的引擎完成
53
- ——文字仍是文字,不像基于 canvas 的 PDF 库那样把整页栅格化。
51
+ Markdown 源码。
52
+
53
+ 渲染态的 Markdown 与 HTML 还带 **导出** 菜单,**直接下载文件**(不走打印对话框),
54
+ 两种格式:
55
+
56
+ | 格式 | 说明 |
57
+ |---|---|
58
+ | **PDF** | 页面的图像:按 A4 排版并分页切分。其中的文字**不可选中**。这是刻意的:中文文档若用文本模式生成 PDF,就必须在插件里内嵌 CJK 字体——对一个预览工具来说是好几 MB |
59
+ | **Word**(`.docx`) | 真正的 Word 文档:标题、列表、表格、代码与图片都在,文字仍是文字——可编辑、可搜索,中文交给 Word 自己的字体渲染 |
60
+
61
+ 文档自带的本地资源会一起带上:Markdown 文件旁边引用的图片,以及 HTML 文件链接的
62
+ 图片与样式表。
54
63
 
55
64
  ## 环境要求
56
65
 
@@ -129,8 +138,12 @@ profile。
129
138
  URL、绝对路径则交给渲染器自己的规则:第一个保持原样,第二个直接加载,第三个
130
139
  不会去读。
131
140
  - **HTML 预览不解析相对资源**:由 Blob 文档绘制出的页面没有可用来解析自身
132
- `style.css` 或图片的 base,所以同样只有绝对 URL 能加载。导出时按渲染结果打印,
133
- 且不带脚本——静态 PDF 本来也用不上脚本。
141
+ `style.css` 或图片的 base,所以预览里只有绝对 URL 能加载。**导出时会解析**——
142
+ 写出的文件来自一份被补齐成自包含的副本——所以可能有「预览里看不到图,导出里
143
+ 有图」的情况。
144
+ - **PDF 里的文字是图像**,无法选中或搜索。需要文字可编辑时请导出 Word。
145
+ - **超长文档会在 60 页 PDF 处截断**,单张超过 8 MiB 的图片会被跳过;写在这里是因为
146
+ 静默截断会被误认为完整导出。
134
147
 
135
148
  ## 参与开发
136
149