nanoblocktech/markdown

PHP parsedown plugin to allow video and table of content.

1.6.0 2024-05-14 16:17 UTC

This package is auto-updated.

Last update: 2024-05-14 16:18:31 UTC


README

PHP Parsedown extension to embed video and audio in markdown formatting. Additionally, it supports creating a table of contents and automatically inserts target="_blank" anchor if links don't match your hostname.

composer install nanoblocktech/markdown

Initialize markdown.

$markdown = new Markdown();

Configure markdown

// Enable table of contents
$markdown->tableOfContents(true);

// Set heading to allow in the table of contents
$markdown->setHeadings(['h1', 'h2']);

// Set id prefix for table of contents 
$markdown->setIdPrefix('my-contents-');

// Add a base link to markdown
$markdown->setLink('https://example.com/assets/');

// Set media type
$markdown->setMediaType('audio/ogg; codecs=opus');

// Get table of contents
$arry = $markdown->getTableOfContents();

Display your markdown text

$markdown->text('### Hello');