pixelbrackets / markdown-mini-page
Quickly convert Markdown into a valid HTML5 page with minimal styles
Installs: 10 132
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/pixelbrackets/markdown-mini-page
Requires
- php: ^8.1
- erusev/parsedown: ^1.7 || ^2.0
- pixelbrackets/html5-mini-template: ^2.1
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-02-04 08:16:23 UTC
README
Quickly convert Markdown into a valid HTML5 page with minimal styles.
![]()
⭐ You like this package? Please star it or send a tweet. ⭐
Vision
Most Markdown packages only convert a given Markdown snippet to HTML. They don't wrap the surrounding page markup - the doctype, title, head, and body tags are missing. They also don't include stylesheets. As a developer you soon find yourself gluing different packages and self-made code together for a task which should be straightforward: Just generate a complete page from this Markdown.
This package does exactly that: pass in a Markdown string, get back a complete, styled HTML5 page ready to serve or save.
Common use cases:
- README rendering - Display repository README files as styled HTML pages
- Documentation pages - Convert Markdown docs into viewable web pages
- Changelog preview - Render CHANGELOG.md as a browsable page
- Status pages - Generate "All Systems Operational" or maintenance notices
- Build artifacts - Create HTML reports, release notes, or coverage summaries
- Note viewer - Quick preview of personal Markdown notes or wiki pages
Highlights:
- Minimal implementation - Three lines of code are enough → 🤗 thanks to pixelbrackets/html5-mini-template
- GitHub Flavored Markdown conversion → 🤗 thanks to erusev/parsedown
- GitHub Markdown stylesheet include → 🤗 thanks to pixelbrackets/gfm-stylesheet
See »Usage« for some examples.
The package follows the KISS principle.
Quick Start
$markup = (new \Pixelbrackets\MarkdownMiniPage\MarkdownMiniPage())
->setContent('Hello _Markdown_ World!')
->getMarkup();
echo $markup;
Requirements
- PHP
Installation
Packagist Entry https://packagist.org/packages/pixelbrackets/markdown-mini-page/
Source
https://gitlab.com/pixelbrackets/markdown-mini-page/
Mirror https://github.com/pixelbrackets/markdown-mini-page/ (Issues & Pull Requests mirrored to GitLab)
Demo
🚀 https://markdown-mini-page.app.pixelbrackets.de/
Usage
This package supports all options of the
pixelbrackets/html5-mini-template
package. For example setStylesheet() to overwrite the default stylesheet.
setContent(string $markdown)- Set Markdown content (converted to HTML on output)setTitle(string $title)- Set document title (auto-detected from first h1 if not set)setStylesheet(string $stylesheet)- Stylesheet keyword or URL (default:gfm)- Available stylesheet selectors (eg.
barebonewill link the barebone stylesheet):barebone,bootstrap,gfm(default),milligram,minicss,mui,mvp,picnic,skeleton
- Available stylesheet selectors (eg.
setStylesheetMode(string $mode)-Html5MiniTemplate::STYLE_LINK(default) orSTYLE_INLINEsetAdditionalMetadata(string $html)- Add tags to document head (meta, link, etc.)getMarkup(): string- Returns complete HTML5 document
All methods, except for getMarkup(), may be chained together.
Convert a message written in Markdown style into HTML, wrap into a HTML5 document and link a minimal stylesheet
$markup = (new \Pixelbrackets\MarkdownMiniPage\MarkdownMiniPage()) ->setContent('Hello _Markdown_ World!') ->getMarkup(); echo $markup;Convert & wrap a message, set your own stylesheet URL and title
$template = (new \Pixelbrackets\MarkdownMiniPage\MarkdownMiniPage()) ->setStylesheet('/assets/styles.css') ->setTitle('Index') ->setContent('# Status' . PHP_EOL . 'All Systems Operational'); echo $template->getMarkup();Embed stylesheet inline instead of linking (useful for single-file HTML output)
use Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate; $template = (new \Pixelbrackets\MarkdownMiniPage\MarkdownMiniPage()) ->setStylesheetMode(Html5MiniTemplate::STYLE_INLINE) ->setContent('# Standalone Page'); echo $template->getMarkup();Add custom metadata to the document head (e.g., Open Graph tags, favicon)
$template = (new \Pixelbrackets\MarkdownMiniPage\MarkdownMiniPage()) ->setAdditionalMetadata('<link rel="icon" href="/favicon.ico">') ->setContent('# Page with Favicon'); echo $template->getMarkup();
License
GNU General Public License version 2 or later
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html.
Author
Dan Kleine (mail@pixelbrackets.de / @pixelbrackets)
Changelog
See CHANGELOG.md
Contribution
This script is Open Source, so please use, share, patch, extend or fork it.
Contributions are welcome!
Feedback
Please send some feedback and share how this package has proven useful to you or how you may help to improve it.