2017 © Pedro Peláez
 

library mym-parser

Parse YAML metadata from a markdown document

image

ninjabachelor/mym-parser

Parse YAML metadata from a markdown document

  • Sunday, December 27, 2015
  • by ninjabachelor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MYMParser

Build Status Latest Stable Version, (*1)

Markdown YAML metadata parser. Parse YAML metadata from a markdown document., (*2)

Installation

Install the latest version with:, (*3)

$ composer require ninjabachelor/mym-parser

Usage

In order to be parsed, metadata must be placed at the beginning of the markdown document between two triple dashes. Example:, (*4)

---
title: Lorem ipsum dolor sit amet
author: Marcus Antonius
keywords: latin, ipsum
---

Vestibulum tortor quam, *feugiat vitae*, ultricies eget, tempor sit amet, ante.

Here's how to parse the metadata:, (*5)

<?php

use Ninjabachelor\MYMParser\Parser;

// Load document source.
$source = file_get_contents('document.md');

// Parse source. Result is a two-element associative array
$result = Parser::parse($source);

// The first element, 'metadata', is the array of parsed metadata. Example:
//
// array(
//     'title'     =>  'Lorem ipsum dolor sit amet',
//     'author'    =>  'Marcus Antonius',
//     'keywords'  =>  'latin, ipsum'
// );
$result['metadata'];

// The second element, 'content', is the document source without metadata. Example:
//
// Vestibulum tortor quam, *feugiat vitae*, ultricies eget, tempor sit amet, ante.
$result['content'];

License

MYMParser is licensed under the MIT License. See the LICENSE file for details., (*6)

Credits

This library is inspired by daylerees' Kurenai., (*7)

The Versions

27/12 2015

dev-master

9999999-dev https://github.com/ninjabachelor/mym-parser

Parse YAML metadata from a markdown document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alberto Terragni

markdown yaml metadata

27/12 2015

v1.0.1

1.0.1.0 https://github.com/ninjabachelor/mym-parser

Parse YAML metadata from a markdown document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alberto Terragni

markdown yaml metadata

11/12 2015

v1.0.0

1.0.0.0 https://github.com/ninjabachelor/mym-parser

Parse YAML metadata from a markdown document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alberto Terragni

markdown yaml metadata