@songmu/mdhq 0.0.4 → 0.0.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
@@ -21,6 +21,7 @@ mdhq get https://example.com/article
21
21
  mdhq get https://example.com/article https://example.com/another-article
22
22
  cat urls.txt | mdhq get
23
23
  mdhq get --update https://example.com/article
24
+ mdhq get --assets https://example.com/article
24
25
  mdhq get --no-assets https://example.com/article
25
26
  mdhq get --json --header 'Cookie: session=value' https://example.com/article
26
27
  mdhq list
@@ -102,7 +103,8 @@ const saved = await getPage({
102
103
 
103
104
  `convertHtml` performs extraction without fetching or writing files.
104
105
  `getPage` fetches, converts, optionally localizes images, adds frontmatter,
105
- and saves the document. Set `assets: false` or use `--no-assets` to keep
106
+ and saves the document. Use `--assets` or `--no-assets` to override the
107
+ configured asset behavior. Set `assets: false` or use `--no-assets` to keep
106
108
  absolute image URLs without creating `_assets`.
107
109
 
108
110
  Saved frontmatter uses Obsidian Web Clipper-compatible names such as `title`,
package/dist/cli.js CHANGED
@@ -65,6 +65,7 @@ export function createProgram(io = process) {
65
65
  .description("Fetch and save web pages.")
66
66
  .argument("[urls...]")
67
67
  .option("--root <path>", "storage root")
68
+ .option("--assets", "download images")
68
69
  .option("--no-assets", "do not download images")
69
70
  .option("--update", "update an existing page")
70
71
  .option("--user-agent <value>", "HTTP User-Agent")
@@ -91,7 +92,7 @@ export function createProgram(io = process) {
91
92
  const result = await getPage({
92
93
  url,
93
94
  ...(options.root ? { root: options.root } : {}),
94
- ...(options.assets === false ? { assets: false } : {}),
95
+ ...(options.assets !== undefined ? { assets: options.assets } : {}),
95
96
  update: options.update ?? false,
96
97
  ...(options.userAgent ? { userAgent: options.userAgent } : {}),
97
98
  headers: parseHeaders(options.header),
@@ -106,10 +106,11 @@ Otherwise configuration overrides the built-in default.
106
106
  The CLI `--user-agent` option is passed as `GetPageOptions.userAgent` and
107
107
  therefore overrides configuration `userAgent`.
108
108
 
109
- The CLI `--no-assets` option passes `GetPageOptions.assets: false` and
110
- therefore overrides configuration `assets`. When asset localization is
111
- disabled, image destinations remain absolute URLs, the result contains no
112
- asset entries, and mdhq does not create `_assets`.
109
+ The CLI `--assets` and `--no-assets` options pass
110
+ `GetPageOptions.assets: true` and `GetPageOptions.assets: false`,
111
+ respectively, and therefore override configuration `assets`. When asset
112
+ localization is disabled, image destinations remain absolute URLs, the result
113
+ contains no asset entries, and mdhq does not create `_assets`.
113
114
 
114
115
  Generic CLI `--header` values and library `headers` values are appended after
115
116
  mdhq creates its `Accept` and User-Agent headers. A generic `User-Agent` or
@@ -506,10 +506,11 @@ For images:
506
506
 
507
507
  Asset localization is enabled by default. It can be disabled with the
508
508
  top-level configuration field `assets: false`, library option
509
- `GetPageOptions.assets: false`, or CLI option `--no-assets`. The library
510
- option and CLI option take precedence over configuration. When disabled,
511
- HTTP(S) image destinations are kept as absolute URLs, the result `assets`
512
- array is empty, and `_assets` is not created.
509
+ `GetPageOptions.assets: false`, or CLI option `--no-assets`. The CLI options
510
+ `--assets` and `--no-assets` explicitly enable or disable localization and
511
+ take precedence over configuration, as does the library option. When
512
+ disabled, HTTP(S) image destinations are kept as absolute URLs, the result
513
+ `assets` array is empty, and `_assets` is not created.
513
514
 
514
515
  mdhq does not rewrite ordinary links to other locally stored Markdown
515
516
  files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songmu/mdhq",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Save web pages as Markdown in a ghq-inspired filesystem layout.",
5
5
  "type": "module",
6
6
  "bin": {