@choonkeat/md-serve 0.1.0 → 0.2.0

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.
Files changed (2) hide show
  1. package/README.md +18 -10
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -33,16 +33,24 @@ md-serve -version
33
33
  [github-markdown-css](https://github.com/sindresorhus/github-markdown-css).
34
34
  Fenced code blocks are syntax-highlighted via
35
35
  [chroma](https://github.com/alecthomas/chroma) (200+ languages).
36
- - Directories show a generated listing with **Name / Size / Modified**
37
- columns. If `index.md` / `README.md` / `readme.md` / `index.markdown`
38
- is present, it's rendered below the listing GitHub-style. If only
39
- `index.html` is present, it's served raw.
40
- - Source files (`.go`, `.py`, `.json`, `.yaml`, `.toml`, `Dockerfile`,
41
- `Makefile`, ...) render as syntax-highlighted HTML with linkable line
42
- numbers (`/main.go#L42`). Append `?raw=1` to any URL to bypass and
43
- fetch the byte-for-byte original. Files larger than 1 MiB or that
44
- look binary skip highlighting and stream raw.
45
- - Everything else is served byte-for-byte.
36
+ - Directories: if `index.html` is present it's served raw (matches
37
+ nginx / Apache / Caddy / GitHub Pages, so md-serve can host real
38
+ static apps). Otherwise, if `index.md` / `README.md` / `readme.md` /
39
+ `index.markdown` is present, a combined page renders the directory
40
+ listing on top and the rendered README below GitHub-style. Otherwise
41
+ a plain generated listing with **Name / Size / Modified** columns.
42
+ - Everything else is served byte-for-byte. That means `.js`, `.css`,
43
+ `.wasm`, `.json`, images, fonts, and the rest all reach the browser
44
+ with their normal MIME types ES module scripts load, fetch() works,
45
+ the static-app use case Just Works.
46
+ - Source files (`.go`, `.py`, `.yaml`, `.toml`, `Dockerfile`,
47
+ `Makefile`, ...) can be viewed as syntax-highlighted HTML with
48
+ linkable line numbers (`/main.go#L42`) by appending `?pretty=1` to
49
+ the URL. Directory listings already link source files this way, so
50
+ clicking from a listing lands on the highlighted view while direct
51
+ URLs / `curl` / `<script src>` get the raw bytes. Files larger than
52
+ 1 MiB, files that look binary, or files chroma can't lex stay raw
53
+ even with `?pretty=1`.
46
54
  - Dotfiles are hidden from listings.
47
55
  - Path traversal is blocked: requests are rejected if they resolve
48
56
  outside the served root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choonkeat/md-serve",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Tiny static file server that renders Markdown as GitHub-styled HTML",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,11 +19,11 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "optionalDependencies": {
22
- "@choonkeat/md-serve-darwin-arm64": "0.1.0",
23
- "@choonkeat/md-serve-darwin-x64": "0.1.0",
24
- "@choonkeat/md-serve-linux-arm64": "0.1.0",
25
- "@choonkeat/md-serve-linux-x64": "0.1.0",
26
- "@choonkeat/md-serve-win32-arm64": "0.1.0",
27
- "@choonkeat/md-serve-win32-x64": "0.1.0"
22
+ "@choonkeat/md-serve-darwin-arm64": "0.2.0",
23
+ "@choonkeat/md-serve-darwin-x64": "0.2.0",
24
+ "@choonkeat/md-serve-linux-arm64": "0.2.0",
25
+ "@choonkeat/md-serve-linux-x64": "0.2.0",
26
+ "@choonkeat/md-serve-win32-arm64": "0.2.0",
27
+ "@choonkeat/md-serve-win32-x64": "0.2.0"
28
28
  }
29
29
  }