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.
h1 → h2)
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
Copy this module into your ProcessWire site under:
/site/modules/MarkdownImporter/
In the ProcessWire admin, go to Modules → Refresh, then install Markdown Importer.
The module creates three fields automatically:
md_import_files – file upload (accepts .md)md_import_items – Repeater fieldmd_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.
Add md_import_files and md_import_items to any template where you want to use this feature.
⚙️ Usage
- Edit a page with the configured template
- Upload one or more
.md files to the Markdown files field - Save the page
- 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
| Markdown | HTML tag |
|---|
# Heading to ###### Heading | h1 – h6 |
| Paragraph (blank line) | p |
> Quote | blockquote |
- Item / * Item | ul, li |
1. Item | ol, li |
``` Code ``` | pre, code |
--- / *** | hr |
| Table | | table, thead, tbody, tr, th, td |
Mappable inline elements
| Markdown | HTML tag |
|---|
**bold** | strong |
*italic* | em |
~~strikethrough~~ | del |
`code` | code |
[Link](url) | a |
 | 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