ForgeMarkDown Module
Overview
ForgeMarkDown is a lightweight and efficient Markdown processor designed to seamlessly convert Markdown files to HTML within the Forge Framework ecosystem. It's built to work without configuration and integrates perfectly with other modules like ForgeStaticGen.
Features
- Zero Configuration: Works out of the box with sensible defaults
- Standard Markdown Support: Full support for standard Markdown syntax
- HTML Output: Clean and semantic HTML generation
- Module Integration: Seamless integration with ForgeStaticGen and other modules
- Extensible: Easy to extend with custom Markdown features
Usage
Using ForgeMarkDown is straightforward. Here's a basic example:
use Forge\Modules\ForgeMarkDown\ForgeMarkDown;
// Get the markdown parser instance
$markdownParser = new ForgeMarkDown();
// Convert markdown to HTML
$markdown = "# Hello World\n\nThis is a **bold** text";
$html = $markdownParser->parse($markdown);
// The result will be proper HTML
// Hello World
// This is a bold text
Integration with ForgeStaticGen
ForgeMarkDown is commonly used with ForgeStaticGen for static site generation. The integration is automatic when both modules are installed:
use Forge\Modules\ForgeStaticGen\ForgeStaticGen;
use Forge\Modules\ForgeMarkDown\ForgeMarkDown;
// ForgeStaticGen automatically uses ForgeMarkDown for processing
$staticGen = new ForgeStaticGen($markdownParser, 'public/static');
// Generate static files from markdown
$staticGen->generate();
Note: ForgeStaticGen uses 'public/static' as the default output directory. This can be customized through configuration.