Metadata-Version: 2.4
Name: save-page-as-md
Version: 0.1.0a0
Summary: Download a webpage and save its content as Markdown, organizing the output on disk to mirror the webpage's domain and path.
Author-email: Jifeng Wu <jifengwu2k@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/jifengwu2k/save-page-as-md
Project-URL: Bug Tracker, https://github.com/jifengwu2k/save-page-as-md/issues
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=2
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: markdownify
Dynamic: license-file

# `save-page-as-md`

Download a webpage and save its content as Markdown, organizing the output on disk to mirror the webpage's domain and path.

## Installation

```bash
pip install save-page-as-md
```

## Usage

```bash
python -m save_page_as_md <URL> [-o OUTPUT]
```

- `-o OUTPUT`, `--output OUTPUT`: Optional. File path to write output Markdown.
  - Use `-` to print to stdout.
  - If not provided, output is saved in a folder structure based on the URL (see below).

## Examples

**Save the Python Wikipedia page in a folder structure mirroring its URL:**

```bash
python -m save_page_as_md https://en.wikipedia.org/wiki/Python_(programming_language)
```

Output will be placed in the directory:

```
./en.wikipedia.org/wiki/Python_(programming_language)/index.md
```

Save to a custom file:

```bash
python -m save_page_as_md https://example.com -o example.md
```

Print Markdown to the terminal:

```bash
python -m save_page_as_md https://example.com -o -
```

## Caveats

- For sites that require login or have JavaScript-loaded content, results may be incomplete.
- Only HTTP and HTTPS are supported.
- Some rare filenames/paths may be problematic on Windows due to reserved device names (e.g., `CON`, `AUX`) - review output on Windows systems.

## Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

## License

This project is licensed under the [MIT License](LICENSE).
