Installation¶
Requirements¶
Markdownify needs a conversion library and two core modules:
- Drupal 9, 10, or 11 (
core_version_requirement: ^9 || ^10 || ^11). - Core's Node (
node) and Taxonomy (taxonomy) modules — the default supported entity types. They are enabled on most sites already. - The
league/html-to-markdownPHP library (^5.1), which does the actual HTML‑to‑Markdown conversion. Composer pulls it in automatically. - Optional:
league/commonmark— suggested if you want extended Markdown formatting via a custom converter.
Because the conversion library is a Composer dependency, install with Composer (below) rather than downloading a zip, or the library will be missing.
Installation¶
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Using Composer:
composer require drupal/markdownify -W
The -W (--with-all-dependencies) flag lets Composer bring in the
league/html-to-markdown library and any shared dependencies as needed.
Using DDEV? Prefix Composer and Drush with
ddevwhen you run from your host machine —ddev composer require drupal/markdownify -W,ddev drush …. Inside the container (ddev ssh) run them without the prefix.
Then enable the module using Drush:
drush en markdownify -y
Submodules — enable only what you need¶
Markdownify ships four optional submodules. Enable them individually with drush en:
| Submodule | Machine name | What it adds |
|---|---|---|
| Markdownify Path | markdownify_path |
Lets you reach Markdown via a content item's path alias with .md — e.g. /blog/my-post.md — not just the canonical /node/1.md. |
| Markdownify Views | markdownify_views |
Produces Markdown versions of Views listing pages, so listings are consumable as Markdown too. |
| Markdownify File Attachment | markdownify_file_attachment |
Inlines the contents of small attached text files (.txt, .yml, .json, …) directly into the Markdown output. Requires core ^10.2 || ^11. |
| Markdownify Metadata | markdownify_metadata |
Prepends a YAML frontmatter block (title, author, dates, tags, images, license — plus Open Graph / JSON-LD when Metatag / Schema Metatag are present) to the Markdown. New in 1.2.x; requires core ^10 || ^11. |
Optional: Enable the Markdownify Path submodule¶
The Markdownify Path submodule allows users to access Markdown-formatted content using human-readable path aliases. Enable it with Drush:
drush en markdownify_path -y
Alternatively, enable both the main module and submodule via the Drupal admin UI by navigating to Extend and selecting "Markdownify" and "Markdownify Path".
Optional: Enable the Markdownify Views Pages submodule¶
The Markdownify Views Pages submodule (markdownify_views) extends
Markdownify support to Drupal Views pages. It enables Markdown-formatted
versions of views, making it easier to consume structured content in Markdown
format.
Enable it with Drush:
drush en markdownify_views -y
Or enable it via the Drupal admin UI by navigating to Extend and selecting " Markdownify Views Pages".
Once enabled, this submodule allows users to retrieve Markdown versions of Views
pages using the same access methods as regular entities, such as appending .md
to URLs or using query parameters.
Optional: Enable the Markdownify Metadata submodule¶
The Markdownify Metadata submodule gathers metadata and outputs it as prepended YAML frontmatter with the MarkDown. The goal is to be (nearly) as complete in terms of metadata as the HTML version of a page in order to provide context for AI agents and anyone else consuming MarkDown output.
Sources of metadata:
-
Drupal metadata: This includes URL, title, author, created and changed dates, publication status, etc. This data is always output when the Markdownify Metadata submodule is enabled.
-
Fields: Fields are iterated over, and data from applicable fields is always output when the Markdownify Metadata submodule is enabled. Applicable fields include: title, summary, image and media references, file references, term references.
-
Metatag module: If installed and enabled, and if configured to be included (on by default), basic metatags and Open Graph info are collected and output. Entries (e.g. title) are deduplicated, and metatag module entries are used rather than the other entries under the assumption that this information was configured with intention and care.
-
Schema Metatag module: If installed and enabled, and if configured to be included (on by default), JSON-LD schema data are collected and output.
Enable it with Drush:
drush en markdownify_metadata -y
Alternatively, enable both the main module and submodule via the Drupal admin UI by navigating to Extend and selecting "Markdownify" and "Markdownify Metadata".
That's all that's needed — Markdown is immediately available for nodes and taxonomy
terms at their .md URLs. To restrict which content is exposed or tune the converter,
see How to use it.
Grant the admin permission¶
The module defines an Administer markdownify permission at People → Permissions
(/admin/people/permissions) that gates the settings form. Grant it to whoever should
manage Markdownify's configuration (administrators by default).