Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

menu_markdown_token

1 sites No security coverage
View on drupal.org

Provides tokens that output menu hierarchies in markdown format.

Installation

  1. Enable the module: drush en menu_markdown_token
  2. Clear cache: drush cr

Usage

The module provides a dynamic token type [menu-markdown] that accepts menu machine names and optional depth parameters.

Token Syntax

[menu-markdown:MENU_MACHINE_NAME]
[menu-markdown:MENU_MACHINE_NAME:DEPTH]

Parameters

  • MENU_MACHINE_NAME (required): The machine name of the menu
  • DEPTH (optional): Maximum depth to traverse. Defaults to 10 if not specified.

Examples

[menu-markdown:main]          # Main menu with default depth of 10
[menu-markdown:main:5]        # Main menu limited to 5 levels
[menu-markdown:footer]        # Footer menu with default depth
[menu-markdown:footer:3]      # Footer menu limited to 3 levels
[menu-markdown:account:2]     # Account menu limited to 2 levels

Output Format

The token outputs a hierarchical markdown list with proper indentation (2 spaces per level):

- [Home](/)
- [About](/about)
  - [Our Team](/about/team)
  - [History](/about/history)
- [Services](/services)
  - [Hosting](/services/hosting)
    - [WebOps](/services/hosting/webops)
  - [Support](/services/support)

Use Cases

  • API responses requiring menu structure
  • Integration with LLM prompts and Agentic Systems
  • Documentation generation
  • Content exports
  • Integration with external systems

Features

  • Hierarchical output: Maintains menu parent-child relationships
  • Access control: Respects menu item permissions (hidden items are excluded)
  • Multiple URL types: Handles internal routes, external URLs, and special routes
  • Depth control: Configurable traversal depth via token parameter
  • Caching: Properly cached with menu and language cache tags
  • Special route handling:
    • <front> renders as /
    • <nolink> and <button> render as plain text without URL
    • External URLs preserved as-is

Activity

Total releases
2
First release
Oct 2025
Latest release
6 months ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
0.1.0 Stable Oct 12, 2025
1.x-dev Dev Oct 12, 2025