Download the PHP package yiipress/markdown without Composer
On this page you can find all versions of the php package yiipress/markdown. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yiipress/markdown
More information about yiipress/markdown
Files in yiipress/markdown
Package markdown
Short Description Native PHP Markdown-to-HTML extension powered by bundled MD4C.
License BSD-3-Clause
Informations about the package markdown
Markdown Extension for PHP
yiipress/markdown is a native PHP extension for rendering Markdown to HTML
with bundled MD4C.
[!WARNING] This package is deprecated in favor of https://github.com/iliaal/mdparser/.
Requirements
- PHP 8.2 - 8.5.
- PIE to install the extension.
- On Linux and macOS: C compiler, and
make.
Prebuilt Windows DLLs are attached to GitHub releases.
Install
Install the extension with PIE:
Then require the extension from applications that use it:
Usage
Create a renderer once, then call render() for each Markdown string:
MarkdownOptions is immutable. Pass options to the constructor to choose the
Markdown features accepted by the parser and the HTML renderer flags used for
output.
Defaults enable common extensions:
- tables
- strikethrough
- task lists
- URL, email, and WWW autolinks
- whitespace collapse
- hard soft breaks
- footnotes
- admonitions
- raw HTML blocks and spans
Disable raw HTML by turning off both HTML options:
Optional MD4C extensions can be enabled individually:
MD4C Constants
Most applications should use MarkdownOptions. The extension also exposes
MD4C's raw constants when you need to inspect the generated parser bitmask,
store low-level settings, or pass HTML renderer flags directly.
YiiPress\Markdown\Flagcontains parser feature flags, such asFlag::TABLES,Flag::NO_HTML, andFlag::FOOTNOTES.YiiPress\Markdown\Dialectcontains MD4C dialect presets, such asDialect::COMMONMARKandDialect::GITHUB.YiiPress\Markdown\HtmlFlagcontains flags for MD4C's HTML renderer, such asHtmlFlag::XHTMLandHtmlFlag::VERBATIM_ENTITIES.
Use HtmlFlag values with MarkdownOptions::$rendererFlags:
Use Flag values when you need to inspect or compare parser settings:
Use Dialect values when interoperating with code that expects MD4C's dialect
bitmasks:
Scope
Version 1 is Markdown-to-HTML only. It intentionally does not expose a PHP
callback or event wrapper around MD4C's lower-level md_parse() API.
Compared with mdparser, this package prioritizes MD4C feature coverage and
medium/large input performance. It does not add mdparser-only features such as
smart punctuation, heading anchors, source positions, nofollow links, or tag
filtering.
Development
Run the PHPT suite in Docker:
Show the currently bundled MD4C revision:
Check whether the configured upstream MD4C ref has changed:
Update the vendored MD4C files:
By default, MD4C targets use upstream master. Pass MD4C_REF to check or
upgrade to another branch, tag, or commit:
Bundled MD4C
This package vendors MD4C source code under third_party/md4c/. MD4C is
licensed under the MIT license; its license notice is included at
third_party/md4c/LICENSE.md.
Credits
This extension was inspired by eklausme/php-md4c, an earlier PHP extension wrapper for MD4C.