A JavaScript-based tool for fetching WordPress posts via the public REST API, processing their HTML, and converting the content into Markdown. Built to run in a Node.js environment (with Bun). Optimized for Astro.js frontends. 🚀
- Fetch posts from any public WordPress site.
- Convert HTML post content to clean Markdown.
- Save processed posts locally as
.mdfiles. - Simple configuration using a
.envfile.
Before you start, make sure you have the following installed:
- Bun: A fast JavaScript all-in-one toolkit.
- A WordPress site with the REST API enabled (most public WP sites have it enabled by default).
-
Clone the repository:
git clone [https://github.com/avestair/wordpress-post-processor.git](https://github.com/avestair/wordpress-post-processor.git) cd wordpress-post-processor -
Install the dependencies:
bun install
Configuration is managed through a .env file.
-
Create a
.envfile by copying the example file:cp .env.example .env
-
Edit the
.envfile and add your WordPress site's URL:# The base URL of the WordPress site you want to fetch posts from WP_BASE_URL="[https://your-wordpress-site.com](https://your-wordpress-site.com)"
Once your .env file is configured, you can run the script with a single command:
bun run dev