Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Adds a WordPress plugin that responds with markdown versions of posts and pages when the URL path ends with .md. Uses the existing MarkdownProducer component.

Changes

  • New plugin: plugins/markdown-export/plugin.php
    • Hooks into template_redirect to intercept .md requests
    • Resolves post/page by path using get_page_by_path() with fallback to slug lookup
    • Converts content via MarkdownProducer with frontmatter (title, date, excerpt)
    • Returns 404 for missing posts
    • RFC 5987 compliant Content-Disposition header

Usage

GET /my-post.md          → Markdown of post with slug "my-post"
GET /parent/child.md     → Markdown of hierarchical page

Example Output

---
post_title: "Hello World"
post_date: "2025-01-15 10:00:00"
---

Welcome to my blog.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8da41e9a9fe4cc14d23cf7fcef3b80476f54e511
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/doctrine/instantiator/zipball/0daa7cfba7b009aa3c95ae585322fb596a4ca2ae
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/phar-io/manifest/zipball/65f90285728eae4eae313b8b6ba11b2f5436038e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/fcf8b71aeab4e1a1131d1783cef97b23a51b87a9
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/fyuDcm /usr/bin/composer install --quiet (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aFcZoM /usr/bin/composer install (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Build a simple WordPress plugin that adds the ability to respond with markdown version of my posts and pages if the requested path ends with .md. Assume php-toolkit.phar is available and leverage components/Markdown/class-markdownproducer.php


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 29, 2025 00:11
Co-authored-by: adamziel <205419+adamziel@users.noreply.github.com>
Co-authored-by: adamziel <205419+adamziel@users.noreply.github.com>
Co-authored-by: adamziel <205419+adamziel@users.noreply.github.com>
Copilot AI changed the title [WIP] Add WordPress plugin for markdown response Add markdown-export plugin for serving posts/pages as markdown Nov 29, 2025
Copilot AI requested a review from adamziel November 29, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants