Download the PHP package youyiio/beyong-markdown without Composer
On this page you can find all versions of the php package youyiio/beyong-markdown. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package beyong-markdown
Extension for PHP markdown parse, base on parsedown. (https://github.com/youyiio/beyong-markdown)
Configurable Markdown to HTML converter with Parsedown Extra.
Table of Content
- 1. Installation
- 2. Features
- HTML or XHTML
- Predefined Abbreviations
- Predefined Links
- Attribute on External Links
- Custom Code Class Format
- Custom Code Text Format
- Put
<code>
Attributes on<pre>
Element - Custom Table Class
- Custom Table Alignment Class
- Custom Footnote ID Format
- Custom Footnote Back ID Format
- Custom Footnote Class
- Custom Footnote Link Class
- Custom Footnote Back Link Class
- Custom Footnote Link Text
- Custom Footnote Back Link Text
- Advance Attribute Parser
- Code Block Class Without
language-
Prefix
Installation
usage
~~~ .php use beyong\markdown\ParsedownExtraPlugin; use beyong\markdown\ParsedownExtra;
$parser = new ParsedownExtraPlugin();
// settings ... $parser->code_class = 'lang-%s';
echo $parser->text('# Header {.sth}');
Features
--------
### HTML or XHTML
~~~ .php
$parser->element_suffix = '>'; // HTML5
Predefined Abbreviations
~~~ .php $parser->abbreviations = array( 'CSS' => 'Cascading Style Sheet', 'HTML' => 'Hyper Text Markup Language', 'JS' => 'JavaScript' );
### Predefined Links
~~~ .php
$parser->links = array(
'mecha-cms' => array(
'url' => 'http://mecha-cms.com',
'title' => 'Mecha CMS'
),
'test-image' => array(
'url' => 'http://example.com/favicon.ico',
'title' => 'Test Image'
)
);
Automatic rel="nofollow"
Attribute on External Links
~~~ .php // custom link attributes $parser->links_attr = array();
// custom external link attributes $parser->links_external_attr = array( 'rel' => 'nofollow', 'target' => '_blank' );
// custom image attributes $parser->images_attr = array( 'alt' => "" );
// custom external image attributes $parser->images_external_attr = array();
### Custom Code Class Format
~~~ .php
$parser->code_class = 'language-%s';
~~~ .php $parser->code_class = function($text) { return trim(str_replace('.', ' ', $text)); };
### Custom Code Text Format
~~~ .php
$parser->code_text = '<span class="my-code">%s</span>';
$parser->code_block_text = '<span class="my-code-block">%s</span>';
~~~ .php $parser->code_text = function($text) { return do_syntax_highlighter($text); };
$parser->code_block_text = function($text) { return do_syntax_highlighter($text); };
### Put `<code>` Attributes on `<pre>` Element
~~~ .php
$parser->code_block_attr_on_parent = true;
Custom Table Class
~~~ .php $parser->table_class = 'table-bordered';
### Custom Table Alignment Class
~~~ .php
$parser->table_align_class = 'text-%s';
Custom Footnote ID Format
~~~ .php $parser->footnote_link_id = 'cite_note:%s';
### Custom Footnote Back ID Format
~~~ .php
$parser->footnote_back_link_id = 'cite_ref:%s-%s';
Custom Footnote Class
~~~ .php $parser->footnote_class = 'footnotes';
### Custom Footnote Link Class
~~~ .php
$parser->footnote_link_class = 'footnote-ref';
Custom Footnote Back Link Class
~~~ .php $parser->footnote_back_link_class = 'footnote-backref';
### Custom Footnote Link Text
~~~ .php
$parser->footnote_link_text = '[%s]';
~~~ .php $parser->footnote_link_text = function($text) { return '[' . $text . ']'; };
### Custom Footnote Back Link Text
~~~ .php
$parser->footnote_back_link_text = '<i class="icon icon-back"></i>';
Advance Attribute Parser
{#foo}
→<tag id="foo">
{#foo#bar}
→<tag id="bar">
{.foo}
→<tag class="foo">
{.foo.bar}
→<tag class="foo bar">
{#foo.bar.baz}
→<tag id="foo" class="bar baz">
{#foo .bar .baz}
→<tag id="foo" class="bar baz">
(white-space before#
and.
becomes optional in my extension){foo="bar"}
→<tag foo="bar">
{foo="bar baz"}
→<tag foo="bar baz">
{foo='bar'}
→<tag foo="bar">
{foo='bar baz'}
→<tag foo="bar baz">
{foo=bar}
→<tag foo="bar">
{foo=}
→<tag foo="">
{foo}
→<tag foo="foo">
{foo=bar baz}
→<tag foo="bar" baz="baz">
{#a#b.c.d e="f" g="h i" j='k' l='m n' o=p q= r s t="u#v.w.x y=z"}
→<tag id="b" class="c d" e="f" g="h i" j="k" l="m n" o="p" q="" r="r" s="s" t="u#v.w.x y=z">
Code Block Class Without language-
Prefix
Dot prefix in class name are now becomes optional, custom attributes syntax also acceptable:
php
→<pre><code class="language-php">
php html
→<pre><code class="language-php language-html">
.php
→<pre><code class="php">
.php.html
→<pre><code class="php html">
.php html
→<pre><code class="php language-html">
{.php #foo}
→<pre><code id="foo" class="php">
All versions of beyong-markdown with dependencies
ext-mbstring Version *