Rendering markdown from PHP code

Overview

JBZoo / Markdown

Coverage Status Psalm Coverage
Stable Version Latest Unstable Version Dependents GitHub Issues Total Downloads GitHub License

Installing

composer require jbzoo/markdown

Usage

Rendering Table

<?php declare(strict_types=1);

use JBZoo\Markdown\Table;

echo (new Table())
    ->addAutoIndex('Index', 999)
    ->setHeaders(['Header #1', 'Header #2'])
    ->setAlignments([Table::ALIGN_CENTER, Table::ALIGN_RIGHT])
    ->appendRow(['123', '456'])
    ->appendRows([
        ['789_1', '9871'],
        ['789_2', '']
    ])
    ->render();

Result

| Index | Header #1 | Header #2 |
|------:|:---------:|----------:|
|   999 |    123    |       456 |
|  1000 |   789_1   |      9871 |
|  1001 |   789_2   |           |
See Live Example
Index Header #1 Header #2
999 123 456
1000 789_1 9871
1001 789_2

Rendering other tags

<?php declare(strict_types=1);

use JBZoo\Markdown\Markdown;

// Page Navigation
Markdown::title('Page Name', 1));   // # Page Name\n
Markdown::title('Title', 2));       // ## Title\n
Markdown::title('Sub Title', 3));   // ### Sub Title\n

// [Google](https://google.com)
Markdown::url('Google', 'https://google.com');

// [![Status](https://travis-ci.org/)](https://travis-ci.org/Status)
Markdown::badge('Status', 'https://travis-ci.org/', 'https://travis-ci.org/Status');

// ![Logo](https://google.com/example.jpg)
Markdown::image('https://google.com/example.jpg', 'Logo');

// > Quote LIne 1
// > Quote LIne 2
// > Quote LIne 3
Markdown::blockquote(["Quote LIne 1\nQuote LIne 2\nQuote LIne 3"]);
Markdown::blockquote(['Quote LIne 1', 'Quote LIne 2', 'Quote LIne 3'])

// <details>
//   <summary>Quote Text</summary>
//   
//   Some hidden text
//   
// </details>
Markdown::spoiler('Quote Text', 'Some hidden text');

// ```php
// <?php
// echo 1;
// 
// ```
Markdown::code("<?php\necho 1;\n", 'php');

Unit tests and check code style

make update
make test-all

License

MIT

You might also like...
Easily add routes to your Laravel app by creating Markdown or Blade files

Laravel Pages This package lets you create pages using Markdown or Blade without having to worry about creating routes or controllers yourself. Essent

Render colored  Markdown contents on console terminal
Render colored Markdown contents on console terminal

cli-markdown Render colored markdown contents on console terminal Preview run demo by php example/demo.php Features support auto render color on termi

Generate pseudo-static pages from markdown and HTML files for Flarum

Flarum Pages Generator This is not a Flarum extension. This package provides a Flarum extender that you can use in the local extend.php to define cust

markdown wiki/blog
markdown wiki/blog

Kwiki markdown wiki/blog Usage Place your markdown files in the /wiki directory. Categories are directories and subcategories are subdirectories. If y

Symfony 5 bundle to easily create dynamic subpages with Markdown. Useful for help sections and wikis.

MarkdownWikiBundle This bundle allows you to create rich subpages in a Symfony project using Markdown. Pages are stored in a file cache and sourced fr

Gruik ! An open-source markdown note-taking web app. [ABANDONED PROJECT]

What is Gruik ? It's a free & open-source note-taking service. A space where you can store notes, tutorials, code snippets... by writing them in markd

Docbook Tool for static documentation generation from Markdown files

Roave Docbook Tool Static HTML and PDF generator tool for generating documentation from Markdown files. Generates a deployable HTML file from Markdown

PHP Documentation system.

PHP Documentation system Simple but powerful Markdown docs. Features Search within Markdown files Customizable Twig templates (Note: default design is

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.

PHP Markdown PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin https://michelf.ca/ based on Markdown by John Gruber https://daringfireball.net/ Int

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.

PHP Markdown PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin https://michelf.ca/ based on Markdown by John Gruber https://daringfireball.net/ Int

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

phpunit/php-code-coverage Provides collection, processing, and rendering functionality for PHP code coverage information. Installation You can add thi

A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

PHP extension for geospatial rendering with Mapnik
PHP extension for geospatial rendering with Mapnik

PHP7 Mapnik Introduction This project is an extension for PHP 7 that enables geospatial rendering with Mapnik. Create tile generation scripts, dynamic

A PHP class for querying the Twitter API and rendering tweets as an HTML list

TweetPHP A PHP class for querying the Twitter API and rendering tweets as an HTML list. Features Works with Twitter API v1.1 Tweets are cached to avoi

 PHP SIP Parsing/Rendering Library
PHP SIP Parsing/Rendering Library

PHP SIP Parsing/Rendering Library RFC 3261 compliant SIP parsing and rendering library for PHP 7.4. Quickstart SIP Message Parsing Once installed, you

FyreView is a free, open-source template rendering library for PHP.

FyreView FyreView is a free, template rendering library for PHP. Table Of Contents Installation Methods Layouts Paths Helper Registry Helpers CSP Form

Engine for performing and rendering text diffs

Text_Diff Engine for performing and rendering text diffs This package provides a text-based diff engine and renderers for multiple diff output formats

A Sidecar function to run Inertia server-side rendering on Lambda.

Sidecar SSR for InertiaJS 🚨 This is currently very much in beta! You can see a fully working Jetstream + Inertia + Sidecar demo repo at hammerstonede

Pug Renderer - a (heavily based on the PhpRenderer) renderer for rendering Pug view scripts into a PSR-7 Response object

Pug Renderer This is a (heavily based on the PhpRenderer) renderer for rendering Pug view scripts into a PSR-7 Response object. It works well with Sli

Releases(1.2.0)
Owner
JBZoo Toolbox
Awesome developer tools and libs
JBZoo Toolbox
Better Markdown Parser in PHP

Parsedown Better Markdown Parser in PHP - Demo. Features One File No Dependencies Super Fast Extensible GitHub flavored Tested in 5.3 to 7.3 Markdown

Emanuil Rusev 14.2k Sep 24, 2022
Highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs.

league/commonmark league/commonmark is a highly-extensible PHP Markdown parser created by Colin O'Dell which supports the full CommonMark spec and Git

The League of Extraordinary Packages 2.3k Sep 28, 2022
Convert HTML to Markdown with PHP

HTML To Markdown for PHP Library which converts HTML to Markdown for your sanity and convenience. Requires: PHP 7.2+ Lead Developer: @colinodell Origi

The League of Extraordinary Packages 1.5k Sep 28, 2022
A PHP tool to generate templateable markdown documentation from the docblocks or type-hints of your codebase.

Roster Installation To install, simply require the package using composer: composer require

Jordan LeDoux 14 Sep 11, 2022
PHP Markdown Engine Support

PHP Markdown Version v1.x support all PHP version >=5.4 v2.x support all PHP version >=7.0 Cài đặt thư viện Thư viện này được cài đặt thông qua Compos

Hung Nguyen 3 Jul 1, 2022
PHP Markdown & Extra

PHP Markdown & Extra An updated and stripped version of the original PHP Markdown by Michel Fortin. Works quite well with PSR-0 autoloaders and is Com

dflydev 173 Jan 18, 2022
A simple regex-based Markdown parser in PHP

Slimdown A simple regex-based Markdown parser in PHP. Supports the following elements (and can be extended via Slimdown::add_rule()): Headers Links Bo

Aband*nthecar 14 Sep 5, 2022
A super lightweight Markdown parser for PHP projects and applications.

A speedy Markdown parser for PHP applications. This is a super lightweight Markdown parser for PHP projects and applications. It has a rather verbose

Ryan Chandler 13 May 31, 2022
PHP based Markdown documentation viewer

PHP based viewer for Markdown files, to view them with fenced code highlighting and navigation.

null 4 Sep 10, 2022
A highly configurable markdown renderer and Blade component for Laravel

A highly configurable markdown renderer and Blade component for Laravel This package contains: a Blade component that can render markdown a highly con

Spatie 204 Sep 23, 2022