jbzoo / markdown
Tools to render markdown text from PHP code
Installs: 899 558
Dependents: 5
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- jbzoo/utils: ^7.1
Requires (Dev)
- jbzoo/toolbox-dev: ^7.1
README
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
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