sideshot/markdown2-tailwindui-php

An opinionated Markdown parser that outputs beautiful Tailwind UI HTML, with custom tags and embed support.

v1.0.0 2025-07-08 19:57 UTC

This package is auto-updated.

Last update: 2025-07-08 20:05:11 UTC


README

Markdown2TailwindUI PHP is an opinionated Markdown parser that transforms plain Markdown into beautiful, responsive HTML layouts styled with Tailwind UI utility classes. It is designed for projects that want rich, styled content without custom CSS or manual HTML tweaks.

Features

  • Tailwind-Ready Output: All HTML is styled with Tailwind utility classes for instant, modern design.
  • Responsive Tables: Markdown tables are converted to responsive, styled layouts.
  • Smart Typography: Smart punctuation for better readability.
  • Embeds: Native support for YouTube, Twitter, GitHub, and more.
  • Custom Tags: Use [MPN:12345] to auto-link part numbers (customizable for your domain).
  • Table of Contents: Automatic TOC generation for long documents.
  • Heading Level Shifting: Optionally shift all headings to fit your page hierarchy.
  • Security: Escapes user input in custom tags to prevent XSS.

Limitations

  • This package is currently tailored for a specific project and may lack flexibility for all use cases.
  • Only a few custom tags are supported out of the box.
  • Configuration options are limited but will expand in future releases.

Roadmap

  • More flexible custom tag/plugin system
  • Additional configuration options
  • Improved accessibility and ARIA support
  • More embed providers

Installation

composer require sideshot/markdown2-tailwindui-php

Usage

use sideshot\Markdown2TailwindUI;

$parser = new Markdown2TailwindUI(['base_header_level' => 3]);
$result = $parser->to_html($markdownString);
echo $result['toc'];   // Table of Contents HTML
echo $result['html'];  // Main HTML content

License

MIT

Author

Richard (@sideshot)