Drupal is a registered trademark of Dries Buytaert

markdownify

422 sites Security covered
View on drupal.org

Markdownify is a Drupal module that provides a seamless solution for generating Markdown versions of your site's content. Via any of the six supported request patterns, this module enables bots, AI agents, and developers to access a lightweight, Markdown-based representation of your site’s content for easier parsing and consumption.

Why MarkDown?

While modern LLMs can ingest and parse raw HTML, Markdown offers significant advantages:

  • Cost Efficiency: AI services charge based on token usage, typically in increments of one million. In our testing, Markdown reduces token count by a 10:1 ratio compared to HTML, leading to lower costs.
  • Faster Processing: The reduction in token count results in quicker processing of your content in Markdown format.
  • Zero distractions: The MarkDown output omits headers, footers, ads, and other irrelevant output, providing a clean and concise context for AI models.
  • Universal Format: Markdown is widely supported and easily understood by AI models, making it the lingua franca for structured text. 1

Six Ways to Access Markdown Content

Once enabled, Markdownify provides six ways to access Markdown-formatted content. With the Markdownify Path submodule enabled, you can also access Markdown content via human-readable path aliases.

  1. Appending .md to the canonical entity URL:

    curl -I https://yourwebsite.com/node/1.md
  2. Appending .md to to Path Aliases (via Markdownify Path Submodule):

    curl -I https://yourwebsite.com/en/articles/give-your-oatmeal-the-ultimate-makeover.md
  3. Using the /markdownify Path Prefix:

    curl -I https://yourwebsite.com/markdownify/node/1
  4. Using the _format Query Parameter:

    curl -I "https://yourwebsite.com/node/1?_format=markdown"

    See https://www.drupal.org/node/2501221 for more information about the "_format" query parameter.

  5. Using the Accept Header:

    curl -I https://yourwebsite.com/node/1 -H "Accept: text/markdown"
  6. Using the Content-Type Header:

    curl -I https://yourwebsite.com/node/1 -H "Content-Type: text/markdown"

How it Works

The Markdownify module leverages the power of the League HTML-to-Markdown Library to convert HTML-rendered content into clean Markdown format.

The required library, league/html-to-markdown, is installed via Composer as part of the module’s dependencies.

When a request for a .md version of an entity is received, the module:

  1. Renders the Entity: The module uses the standard Drupal render pipeline
    to generate the HTML representation of the requested entity.
  2. Converts HTML to Markdown: Using the League\HTMLToMarkdown\HtmlConverter, the module processes the HTML output and transforms it into Markdown format.
  3. Delivers Markdown Output: The Markdown version of the content is served to the client, omitting unnecessary elements like headers, footers, or advertisements.

By removing unnecessary elements like headers, footers, and ads, the output remains concise and AI-friendly.

Activity

Total releases
15
First release
Mar 2025
Latest release
4 months ago
Release cadence
15 days
Stability
33% stable

Release Timeline

Releases

Version Type Release date
1.1.3 Stable Oct 11, 2025
1.1.2 Stable Oct 11, 2025
1.1.x-dev Dev Oct 7, 2025
1.1.1 Stable Jun 19, 2025
1.1.0 Stable Jun 6, 2025
1.0.0 Stable Apr 23, 2025
1.0.0-rc8 Pre-release Apr 4, 2025
1.0.0-rc7 Pre-release Apr 3, 2025
1.0.0-rc6 Pre-release Mar 21, 2025
1.0.0-rc5 Pre-release Mar 20, 2025
1.0.0-rc4 Pre-release Mar 20, 2025
1.0.0-rc3 Pre-release Mar 19, 2025
1.0.0-rc2 Pre-release Mar 14, 2025
1.0.0-rc1 Pre-release Mar 13, 2025
1.0.x-dev Dev Mar 11, 2025