Markdown Importer

Converts uploaded .md files to HTML and stores each as a Repeater item with a richtext field.

A ProcessWire module that converts uploaded .md files to HTML and stores each as a Repeater item with a richtext field.


✨ Features


  • Upload one or more .md files via a file field
  • Each file is converted to HTML using ProcessWire's core TextformatterMarkdownExtra (Parsedown)
  • Each result is stored as a separate Repeater item with a richtext body field
  • Auto-detects your richtext editor – uses TinyMCE if installed, falls back to CKEditor
  • Source filename is preserved in the standard PW title field
  • Processed .md files are automatically removed from the upload field
  • Configurable HTML tag mappings – remap any HTML element to another (e.g. h1h2)

Why this exists


We needed a fast way to get a lots of Markdown content onto a ProcessWire website – as actual HTML, not just runtime-formatted text. Upload the .md files, hit save, done.


Installation


  1. Copy this module into your ProcessWire site under:

    /site/modules/MarkdownImporter/
  2. In the ProcessWire admin, go to Modules → Refresh, then install Markdown Importer.

  3. The module creates three fields automatically:

    • md_import_files – file upload (accepts .md)
    • md_import_items – Repeater field
    • md_import_body – richtext field (converted HTML, inside Repeater – uses TinyMCE or CKEditor, auto-detected at install)

    The Repeater uses the standard PW title field for the source filename.

  4. Add md_import_files and md_import_items to any template where you want to use this feature.


⚙️ Usage


  1. Edit a page with the configured template
  2. Upload one or more .md files to the Markdown files field
  3. Save the page
  4. Each .md file appears as a new Repeater item with the converted HTML in the richtext body field

️ Template output


The Repeater items are regular PW pages – output them however you like. Basic example:

foreach ($page->md_import_items as $item) {
    echo "<section>";
    echo "<h2>{$item->title}</h2>";
    echo "<div>{$item->md_import_body}</div>";
    echo "</section>";
}

Tag mappings


Go to Modules → Configure → Markdown Importer to define HTML tag mappings. One rule per line, format: source:target. Lines starting with # are comments.

Example configuration:

# Shift headings down one level
h1:h2
h2:h3
h3:h4

# Use <b> instead of <strong>
strong:b

# Convert blockquotes to aside
blockquote:aside

# Replace horizontal rules with line breaks
hr:br

Mappings are applied after the Markdown → HTML conversion. Both opening and closing tags are replaced. Attributes (class, href, src, etc.) are preserved.

Note: Mappings perform a simple 1:1 tag replacement. This works well for standalone or equivalent elements (h1:h2, strong:b, em:i, blockquote:aside, hr:br). It does not work for nested structures like tables – writing table:ul would only replace the outer <table> tag while leaving <thead>, <tbody>, <tr>, <th>, <td> untouched, resulting in invalid HTML.

Mappable block elements

MarkdownHTML tag
# Heading to ###### Headingh1h6
Paragraph (blank line)p
> Quoteblockquote
- Item / * Itemul, li
1. Itemol, li
``` Code ```pre, code
--- / ***hr
| Table |table, thead, tbody, tr, th, td

Mappable inline elements

MarkdownHTML tag
**bold**strong
*italic*em
~~strikethrough~~del
`code`code
[Link](url)a
![Image](url)img

⚙️ Requirements


  • ProcessWire 3.0.0+
  • Core module FieldtypeRepeater (installed by default)
  • Core module TextformatterMarkdownExtra (bundled with PW, may need activation)

Feedback & Contributions


Feel free to open issues or submit pull requests.


Developed by frameless Media

More modules by Mikel

  • ProcessDataTables

    Displays customizable backend tables for any ProcessWire template with flexible column selection, per-field output templates, and global formatting options.
  • StripePaymentLinks

    Stripe payment-link redirects, user/purchases, magic link, mails, modals.
  • User Data Table

    Displays a configurable table of user fields in the admin interface.
  • Textformatter Smart Quotes

    Replaces straight quotes "..." with typographic quotes („...“, “...”, or «...»), in visible text only.
  • Data Migrator

    Migrate external data (SQL, CSV, JSON, XML) into ProcessWire
  • StripePaymentLinks Mailchimp Sync

    Sync purchases from StripePaymentLinks to Mailchimp
  • Stripe Payment Links Admin

    View customer, purchases & products with configurable metadata columns & filters. Export reports to CSV.
  • GitSync

    Synchronize ProcessWire modules with GitHub repository branches
  • StripePaymentLinks Customer Portal

    Adds a ready-to-use /account/ page with login flow, product grid, purchase history table, and direct access to the Stripe Customer Billing Portal

All modules by Mikel

Install and use modules at your own risk. Always have a site and database backup before installing new modules.