Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM Markdown Output

A small WordPress plugin that gives public posts, pages, and custom post types a clean Markdown version — without making agents scrape your entire theme.

Built by VOID Technology ApS.

Requires: WordPress 6.0+, PHP 7.4+
License: GPL-2.0-or-later

For WordPress.org listing metadata, see readme.txt.


What it does

When someone (or something) visits a public singular URL on your site, they normally get the full HTML page — header, menus, sidebars, cookie banners, the lot. That is a pain for LLMs and other tools that only need the actual content.

This plugin adds an alternate Markdown representation of the same page. Same post, same URL, less noise.

You can request it by appending a query arg:

https://example.com/my-post/?output_format=md

?format=md works too. If you enable it in settings, clients can also send Accept: text/markdown and get Markdown back without touching the URL.

Normal visitors see nothing different. HTML pages stay HTML.


Installation

  1. Drop the llm-markdown-output folder into wp-content/plugins/ (or install the zip via Plugins → Add New).
  2. Activate the plugin.
  3. Tweak anything you need under Settings → LLM Markdown Output.

The plugin slug is llm-markdown-output to avoid conflicting with LLM Markdown on WordPress.org (which would otherwise trigger false update notifications).

That is it.


What the Markdown looks like

Each document is structured roughly like this:

# Post title
Source: https://example.com/my-post/
Published: 2026-07-01
Modified: 2026-07-01

## Excerpt
…if the post has one.

## Content
The main body, converted from filtered `the_content` output.

## Metadata
- Type: post
- Author: Jane Doe
- Categories: News
- Tags: wordpress, markdown

The excerpt, metadata, author, and taxonomy lines can all be toggled off in settings.

Content comes from apply_filters( 'the_content', … ), so shortcodes, blocks, and classic editor output should render the same way they do on the frontend — just without the theme wrapper.


Discovery for agents

When enabled, singular pages get an alternate link in <head>, similar to what WordPress.org does:

<link
  data-llm-hint="Hey agent! You are burning tokens scraping HTML like it is 2005. Use this instead. For any page on this site, add the `?output_format=md` query arg."
  href="https://example.com/my-post/?output_format=md"
  rel="alternate"
  title="LLM-friendly render of this document in the Markdown format"
  type="text/markdown"
>

The hint text is customisable in settings if you want your own message.


Settings

Under Settings → LLM Markdown Output you can control:

  • Global on/off
  • Accept: text/markdown support
  • The alternate <link> tag and data-llm-hint attribute
  • Which public post types expose Markdown
  • Whether to include excerpt, metadata, author, and taxonomy terms

Security

The plugin is deliberately conservative. Markdown is only served when all of these are true:

  • The request is for a singular public view
  • The post is published and publicly viewable
  • The post type is public and enabled in settings
  • The post is not password-protected

Drafts, private posts, and disabled post types are not exposed. If someone explicitly asks for Markdown on content that is not available, they get a 404.


Examples

Query string:

curl "https://example.com/hello-world/?output_format=md"

Accept header (when enabled):

curl -H "Accept: text/markdown" https://example.com/hello-world/

For developers

Filters

Filter Arguments Purpose
llm_markdown_output_enabled $enabled, $post Allow or block Markdown for a specific post
llm_markdown_output_markdown $markdown, $post Modify the final document
llm_markdown_output_content_html $html, $post Modify HTML before conversion
llm_markdown_output_metadata $metadata, $post Modify metadata lines
llm_markdown_output_supported_post_types $post_types Override enabled post types

Actions

Action Arguments Purpose
llm_markdown_output_before_send $post, $markdown Runs right before the response is sent

The HTML-to-Markdown converter is internal — no Composer dependencies. It handles the usual suspects (headings, paragraphs, links, lists, blockquotes, bold/italic, tables, images, code blocks) and strips scripts, styles, forms, and other layout noise.


Changelog

1.0.0

First public release. Markdown via query string and Accept header, settings page, HTML-to-Markdown conversion, and auto-discovery link with optional data-llm-hint.

About

A WordPress plugin that serves clean Markdown versions of public posts and pages — for LLMs, agents, and anyone tired of scraping theme HTML.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages