orz-mdhtml 0.1.0 → 0.1.1

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
@@ -36,17 +36,16 @@ as the single source of truth; Save/Export re-serialize the whole document.
36
36
 
37
37
  ## Install / generate
38
38
 
39
- Requires Node 18+. Until this package is published to npm, use it from a clone:
39
+ Requires Node 18+. No install needed run it with `npx`:
40
40
 
41
41
  ```bash
42
- git clone https://github.com/wangyu16/orz-mdhtml.git
43
- cd orz-mdhtml
44
- npm install
45
- npm run bundle # build dist/orzmd.browser.js (the in-browser renderer)
46
- npm run gen -- path/to/doc.md # → path/to/doc.md.html
42
+ npx orz-mdhtml path/to/doc.md # → path/to/doc.md.html
47
43
  open path/to/doc.md.html
48
44
  ```
49
45
 
46
+ Or install the CLI globally (`npm i -g orz-mdhtml`), then `orz-mdhtml doc.md`.
47
+ To hack on it, clone the repo and use `npm run gen -- doc.md`.
48
+
50
49
  ### CLI options
51
50
 
52
51
  ```
@@ -54,11 +53,15 @@ orz-mdhtml <input.md> [options]
54
53
 
55
54
  -o, --out <file> output path (default: <input>.md.html)
56
55
  --theme <name> default theme id (default: light-academic-1)
57
- --inline embed the renderer bundle in the file (default; offline-capable renderer)
58
- --cdn reference the renderer from jsDelivr (needs orz-mdhtml-browser published)
56
+ --cdn reference the renderer from jsDelivr (default; small files)
57
+ --inline embed the renderer bundle (larger file, no renderer fetch)
59
58
  --title <text> document <title> (default: input filename)
60
59
  ```
61
60
 
61
+ By default (`--cdn`), the renderer is fetched from jsDelivr on first open and
62
+ cached, so generated files are small (~tens of KB). Use `--inline` to embed the
63
+ renderer (~750 KB) when you want the file to carry its own renderer.
64
+
62
65
  Themes: `light-academic-1/2`, `light-neat-1/2`, `light-playful-1/2`,
63
66
  `beige-decent-1/2`, `dark-elegant-1/2`. (Readers can switch live in the editor.)
64
67
 
@@ -104,7 +107,7 @@ whole-table/blockquote copy fix.
104
107
  - [x] Document-first UI: read / edit, iframe preview, incremental live updates
105
108
  - [x] Theme picker, reader font size, export, scroll-sync toggle
106
109
  - [x] copy-as-markdown via orz-markdown core
107
- - [ ] Publish `orz-mdhtml` (the CLI) and `orz-mdhtml-browser` (CDN bundle) to npm
110
+ - [x] Publish `orz-mdhtml` (the CLI) and `orz-mdhtml-browser` (CDN bundle) to npm
108
111
  - [ ] Optional fully-offline build (inline themes + editor libs)
109
112
  - [ ] Mermaid/KaTeX live re-render parity in the editor
110
113
 
package/assets/app.js CHANGED
@@ -68,6 +68,9 @@
68
68
  + '<script>window.__orzEnhance=function(){'
69
69
  + 'try{if(window.hljs){document.querySelectorAll("#orz-doc pre code:not(.hljs)").forEach(function(b){window.hljs.highlightElement(b)})}}catch(e){}'
70
70
  + 'try{if(window.mermaid){window.mermaid.run({querySelector:"#orz-doc .mermaid:not([data-processed])"})}}catch(e){}'
71
+ // Tabs init runs in the runtime on load (empty #orz-doc); re-run now that
72
+ // content is injected, and after each incremental update. Idempotent.
73
+ + 'try{if(window.OrzMarkdownRuntime&&window.OrzMarkdownRuntime.initTabs){window.OrzMarkdownRuntime.initTabs(document)}}catch(e){}'
71
74
  + '};<\/script></body></html>';
72
75
  }
73
76