Issue #3592796: Allow selecting a view mode per bundle for Markdown output

What this does

Adds a per-bundle setting to choose which view mode is used to render an entity before it is converted to Markdown. When nothing is selected, rendering falls back to the full view mode, so existing behaviour is unchanged.

Rendering through full pulls in fields that are fine for human display but add noise to the Markdown an LLM consumes (related content, share blocks, CTA regions). Because this reuses Drupal's standard view mode system, site builders configure the output with the Manage display tools they already know, rather than a module-specific field list.

Implementation

  • SupportedEntitiesConfigForm: per-bundle view mode select, shown only for bundles that are actually supported (via #states, mirroring the existing include/exclude logic for both "Only those selected" and "All except those selected").
  • MarkdownifyController: resolves the configured view mode per entity type + bundle, falling back to the view_mode argument (full) when unset. The settings config is added as a cacheable dependency.
  • config/schema/markdownify.schema.yml: view_modes as a sequence keyed by bundle.
  • markdownify.services.yml: injects @entity_display.repository into the form.
  • README.md: documents the optional setting.

Note on the earlier revert (32a854d1 "It kills page titles")

A previous global view_mode attempt was reverted because it broke page titles. This approach is per entity type + bundle and does not touch title resolution: the route _title_callback keeps using $entity->label(). Verified locally that the canonical HTML page title stays intact and that both full and a non-full view mode render correctly with their title.

Edited by Daniel Schoone

Merge request reports

Loading