Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Content Translation Redirect Module content_translation_redirect crossed 1,000 active installs.

This module imports Markdown files from GitHub, GitLab, or private repositories into Drupal nodes. It converts Markdown to HTML, allows configuration of target content types and fields, and supports recursive scanning of repositories.

Introduction

The Markdown Importer module is a powerful tool for importing Markdown files into Drupal nodes. It supports integration with both GitHub and GitLab or Private hosted public repositories, making it easy to fetch and transform Markdown files into Drupal content types.

This module utilizes the league/commonmark Markdown parser library for accurate Markdown-to-HTML conversion and provides configuration options for custom content types and fields.

Features

  • Import Markdown files from GitHub and GitLab or Private hosted public repositories.
  • Automatically convert Markdown into HTML using the league/commonmark library.
  • Support for custom content types and target fields.
  • Recursive repository scanning for Markdown files in subdirectories.
  • Validation and error handling for invalid URLs or unsupported platforms.

Requirements

  • Drupal 10/11.
  • Composer (for library dependency management).
  • PHP 8.2 or later.

Installation

  1. Install the module as you would normally install a contributed Drupal module. See Installing Modules for details.
  2. Use Composer to install required dependencies:
    composer require league/commonmark league/commonmark-ext-heading-permalinks league/commonmark-ext-attributes
    

Configuration

Automatic Configuration

  • Upon enabling the module, a default form is provided at /admin/config/services/import-markdown to configure the import process.

Steps to Import Markdown

  1. Navigate to the configuration page for the module.
  2. Enter the Repository URL and select the Platform (GitHub or GitLab or Private hosted git repository).
  3. Choose the Content Type where Markdown content should be imported.
  4. Select the Target Field to store the Markdown content (e.g., body).
  5. Click Import Markdown to start the process.

AJAX-Driven Dynamic Selection

  • The module provides dynamic AJAX-based field selection to ensure compatibility with the selected content type.

Advanced Configuration

  • Customize the Markdown parser settings (e.g., for anchors and attributes) using hook_markdown_importer_config_modify() in a custom module.
  • Utilize the MarkdownProcessor service for programmatic imports.
  • Enable additional features like heading permalinks and custom attributes by modifying the league/commonmark configuration.

Additional Information

  • The module uses html_input: strip and allow_unsafe_links: false for secure Markdown parsing by default. See CommonMark Security Documentation for details.
  • Recursive scanning is enabled to fetch Markdown files from subdirectories of the repository.

Known Limitations

  • This module is currently not compatible with Markdown files containing advanced JavaScript or custom HTML tags unless configured explicitly.
  • Ensure repositories are publicly accessible, as private repositories require additional authentication handling (not included in this version).

Documentation

  • Full documentation is available in the module repository.

Activity

Total releases
3
First release
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

Version Type Release date
1.0.1 Stable Dec 11, 2024
1.x-dev Dev Dec 10, 2024
1.0.0 Stable Dec 10, 2024