WP Markdown Endpoint
Exposes posts and pages as Markdown via .md URL suffix, Accept header negotiation, and auto-discovery links.
★ 5stars
1forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/bph/wp-markdown-endpoint/archive/refs/heads/main.zipReadme
WP Markdown Endpoint
A WordPress plugin that exposes posts and pages as Markdown via .md URL suffix, Accept header negotiation, and auto-discovery links.
Features
.mdURL suffix — append.mdto any post or page URL to receive its content as Markdown (e.g.https://example.com/my-post.md)Acceptheader negotiation — sendAccept: text/markdownto get a Markdown response without changing the URL?format=mdquery parameter — an alternative way to request Markdown output- YAML frontmatter — every Markdown response includes structured metadata (title, date, author, URL, tags, categories, excerpt)
- Canonical
Linkheader — Markdown responses include aLink: <…>; rel="canonical"HTTP header pointing back to the original HTML page - Auto-discovery link — a
<link rel="alternate" type="text/markdown">tag is injected into the HTML<head>of every singular post/page so clients can discover the Markdown URL automatically - HTML-to-Markdown conversion — converts Gutenberg block output (headings, paragraphs, lists, blockquotes, code blocks, images, links, bold, italic, strikethrough) to clean Markdown
Requirements
- WordPress 6.0 or later (uses
str_ends_with()) - PHP 8.0 or later
Installation
- Upload the
wp-markdown-endpointfolder to/wp-content/plugins/. - Activate the plugin through the Plugins menu in WordPress.
- No configuration required.
Usage
Given a post at https://example.com/hello-world/, you can retrieve its Markdown content in three ways:
# URL suffix
GET https://example.com/hello-world.md
# Query parameter
GET https://example.com/hello-world/?format=md
# Accept header
GET https://example.com/hello-world/
Accept: text/markdown
Example response
---
title: Hello World
date: 2026-02-23
author: Jane Doe
url: https://example.com/hello-world/
tags: ["news", "updates"]
categories: ["General"]
---
## Introduction
Welcome to my site! This content is served as **Markdown**.
File Structure
wp-markdown-endpoint/
├── wp-markdown-endpoint.php # Plugin bootstrap, defines constants, loads classes
├── includes/
│ ├── class-rewrite.php # Intercepts .md URL suffix, sets format query var
│ ├── class-output.php # Serves Markdown responses and injects discovery link
│ └── class-converter.php # Converts HTML (Gutenberg output) to Markdown
├── readme.md # This file
└── readme.txt # WordPress.org-compatible readme
License
GPL-2.0+. See https://www.gnu.org/licenses/gpl-2.0.html.
Author
Birgit Pauli-Haack