Support local HTML files for conversion

Allow the CLI argument to be either a remote URL or a local HTML path, and document the new usage in README/help examples.
This commit is contained in:
√(noham)²
2026-07-24 23:05:25 +02:00
parent 9711bc3dc1
commit fd941700d7
5 changed files with 33 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ const program = new Command()
program
.name('pdfy')
.description('Convert web articles to PDF using Reader View and Puppeteer')
.argument('<url>', 'URL of the article to convert')
.argument('<url>', 'URL of the article to convert, or path to a local HTML file')
.option(
'-t, --theme <theme>',
`Reader View theme (${VALID_THEMES.join(', ')})`
@@ -42,6 +42,8 @@ program
Examples:
node src/index.js <URL>
node src/index.js <URL> --theme dark --highlight-style monokai --css config/rules.css
node src/index.js <path/to/file.html> --theme dark --highlight-style monokai
node src/index.js <URL> --prefs config/reader-view-preferences.json
npm start -- <URL> --theme dark --highlight-style monokai --css config/rules.css
`
)