By james, 3 December, 2023
Door 3 containing the Markdown Easy module

Welcome back to day 3 of the Drupal Advent Calendar. Behind today’s door Mike Anello (ultimike) introduces us to the Markdown Easy module.

I’m Mike Anello from DrupalEasy and I’m the maintainer of the Markdown Easy module - a relatively new contrib module I created in order to add a Markdown filter to text formats that doesn’t require a whole lot of configuration. 

Background

Most Drupal site-builders who are familiar with Markdown syntax use the Markdown module. Unfortunately, the Markdown module has had an inconsistent record of timely updates (especially for Drupal 10 compatibility until recently) and suffers (IMHO) from being overly complex to configure. 

I’ve implemented the Markdown module more than a few times over the past decade, and I’ve always wondered why there wasn’t a more straight-forward implementation for those of us who just want a basic Markdown filter. Earlier this year, while I was upgrading a site from Drupal 9 to Drupal 10 and the only blocker was the Markdown module, I decided to take things into my own hands and create a super-straight-forward module to do just that. 

The Markdown Easy module utilizes a well-used Markdown library and is secure by default. Configuration of the module is minimal and encourages site-builders to configure it in a secure manner, but also while providing hooks for more granular configuration. I plan on keeping the module lean and well-supported - with a complete suite of PhpUnit tests to help ensure reliable updates. 

Configuration

Markdown Easy doesn’t have a stand-alone configuration page - its only configuration is on text format configuration pages. Once the module is installed, to utilize the Markdown Easy text filter, simply select the filter on the desired text format (one without a WYSIWYG editor is best).

Markdown Easy Enabled filters

It is also recommended (and enforced by default) that the Markdown Easy filter be configured to run before the “Limit allowed HTML tags and correct faulty HTML” and “Convert line breaks into HTML” filters. This is to ensure a secure authoring environment and predictable results. Again, this behavior can be overridden with a hook implementation (example provided in the module’s documentation). 

Markdown Easy Filter processing order

The only other available option is the option of using “GitHub-flavored Markdown” instead of standard Markdown syntax, which provides some Markdown syntax extensions used on GitHub.com. 

Markdown Easy Filter settings

Summary

If you are looking for a less-complex Markdown text filter for your Drupal site, I encourage you to check it out. 

Photo of Mike Anello

Michael Anello (ultimike) has been a Drupal developer and trainer for over 15 years and is the co-owner of DrupalEasy.com . He is an active member of the Drupal community and lives in Florida. His hobbies include pretty much anything outdoors, including hiking and paddleboarding (and building with LEGO bricks when it is raining).

Comments

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.