@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 +3 -1
- package/dist/cli.js +2 -1
- package/docs/configuration.md +5 -4
- package/docs/specification.md +5 -4
- package/package.json +1 -1
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.
|
|
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
|
|
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),
|
package/docs/configuration.md
CHANGED
|
@@ -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 `--
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
package/docs/specification.md
CHANGED
|
@@ -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
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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.
|