PHP code example of rianfuro / commonmark-metadata
1. Go to this page and download the library: Download rianfuro/commonmark-metadata library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rianfuro / commonmark-metadata example snippets
use CommonMark\Extension\Metadata\MetadataExtension;
$environment = new Environment([]);
// ... other extensions
$environment->addExtension(new MetadataExtension);
new MarkdownConverter($environment);
$metadata = (new Query())
->where(Query::type(MetadataBlock::class))
->findOne($document);
$metadata->data->export(); // note that this always