Download the PHP package birdcar/markdown-php without Composer
On this page you can find all versions of the php package birdcar/markdown-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download birdcar/markdown-php
More information about birdcar/markdown-php
Files in birdcar/markdown-php
Package markdown-php
Short Description Birdcar Flavored Markdown (BFM) — league/commonmark extension suite
License MIT
Informations about the package markdown-php
birdcar/markdown-php
A league/commonmark extension suite for Birdcar Flavored Markdown (BFM) — a superset of CommonMark and GFM that adds YAML front-matter, directive blocks, extended task lists, task modifiers, mentions, hashtags, metadata extraction, and document merging.
See the BFM spec for the full syntax definition.
Packages
This is a monorepo containing the core library and framework integration packages:
| Package | Description | Install |
|---|---|---|
birdcar/markdown-php |
Core library (this repo root) | composer require birdcar/markdown-php |
birdcar/markdown-laravel |
Laravel service provider, Str::bfm() macro, @bfmStyles directive |
composer require birdcar/markdown-laravel |
birdcar/markdown-filament |
Filament v4 BfmEditor, BfmTextColumn, BfmTextEntry |
composer require birdcar/markdown-filament |
Requirements
- PHP 8.2+
- league/commonmark ^2.7
- symfony/yaml ^8.0
Quick Start
Core library (any PHP project)
Laravel
Zero config — the service provider auto-discovers and registers everything:
In Blade templates:
Publish the config to customize the render profile or bind resolver classes:
Filament v4
Drop-in replacement for Filament's MarkdownEditor with server-side BFM preview:
The BfmEditor provides a preview toggle button that renders BFM syntax server-side via Filament v4's callSchemaComponentMethod — no traits or page-level configuration needed.
The Factory
BfmEnvironmentFactory::create() returns a fully configured Environment with CommonMark, GFM (minus task lists, which BFM replaces), and all BFM extensions:
Individual extensions
Each feature is a self-contained extension:
| Class | Description |
|---|---|
FrontmatterExtension |
YAML front-matter (--- blocks) |
TaskExtension |
[x], [>], [!], etc. in list items |
TaskModifierExtension |
//due:2025-03-01, //hard metadata |
MentionExtension |
@username inline references |
HashtagExtension |
#project inline tags |
CalloutExtension |
@callout/@endcallout container blocks |
EmbedExtension |
@embed/@endembed leaf blocks |
DetailsExtension |
@details/@enddetails collapsible sections |
TabsExtension |
@tabs/@tab tabbed content groups |
FigureExtension |
@figure/@endfigure images with captions |
AsideExtension |
@aside/@endaside sidebar content |
MathExtension |
@math/@endmath LaTeX display blocks |
TocExtension |
@toc/@endtoc auto table of contents |
IncludeExtension |
@include/@endinclude file transclusion |
QueryExtension |
@query/@endquery dynamic content |
EndnotesExtension |
@endnotes/@endendnotes footnote rendering |
FootnoteExtension |
[^label] references and [^label]: definitions |
Resolvers
Mentions and embeds can be resolved at render time by implementing the contract interfaces.
MentionResolverInterface:
Without a resolver, mentions render as <span class="mention">@identifier</span>. With a resolver that returns a URL, they render as <a href="..." class="mention">@label</a>.
EmbedResolverInterface:
Without a resolver, embeds render as a <figure> with a plain link. With a resolver that returns html, the resolved HTML is embedded directly.
IncludeResolverInterface:
Resolve file transclusion for @include directives:
Without a resolver, @include renders as a placeholder <div> with data attributes.
QueryResolverInterface:
Resolve dynamic content for @query directives:
Without a resolver, @query renders as a placeholder <div> with data attributes.
ComputedFieldResolverInterface:
Extend metadata extraction with custom computed fields:
Metadata Extraction
Extract structured metadata from parsed documents:
Custom computed fields via resolvers:
Document Merging
Deep-merge front-matter and concatenate body content across multiple documents:
Styling
The @bfmStyles Blade directive (from birdcar/markdown-laravel) outputs a default stylesheet covering all BFM output elements. The stylesheet uses CSS custom properties for theming and supports both prefers-color-scheme: dark and class-based dark mode (.dark).
To publish the stylesheet for customization:
Override any variable in your own CSS:
The Filament package automatically loads BFM styles into the admin panel.
Syntax Reference
YAML Front-matter
Front-matter must appear at the very start of the document. The YAML content is parsed and available via FrontmatterBlock::getParsedData().
Extended Task Lists
Seven states, inspired by Bullet Journal:
Task Modifiers
Inline metadata on task items using //key:value syntax:
Mentions
Hashtags
Identifiers follow the pattern [a-zA-Z][a-zA-Z0-9_-]*. The # must not be preceded by an alphanumeric character. Hashtags inside code spans are not parsed.
Directive Blocks
Callouts (container — body is parsed as markdown):
Embeds (leaf — body is treated as caption text):
Details (container — collapsible section):
Tabs (container — tabbed content groups):
Figure (container — image with caption):
Aside (container — sidebar content):
TOC (leaf — auto-generated table of contents):
Math (leaf — LaTeX display block):
Include, Query, Endnotes (leaf — resolver-dependent or structural):
Footnotes
Pandoc-style footnote references and definitions:
Footnotes are auto-numbered in order of first reference. If no @endnotes directive is present, the endnotes section is appended at the end of the document.
HTML Output
The extensions produce semantic, BEM-style HTML:
License
MIT