Skip to content

๐Ÿ“‘ Kurenai is a Markdown document parser which allows for extra metadata to be associated with the document.

License

Notifications You must be signed in to change notification settings

laravie/kurenai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kurenai

Kurenai is a Markdown document parser which allows for extra metadata to be associated with the document.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Introduction

Confused? Let's take a look at how it works.

This is what your documents might look like:

title: This is my document title.
slug: this-is-the-slug
date: 12th December 1984
-------
This is my **markdown** content!

and here is how you will parse it with Kurenai :

<?php

// Use the Kurenai document parser.
use Kurenai\Document;
use Kurenai\DocumentParser;
use Kurenai\Parser\Parsedown;

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

// Create a new document parser
$parser = new DocumentParser(new Document(new Parsedown));

// Parse the loaded source.
$document = $parser->parse($source);

// To get the document content in raw markdown format..
// This is my **markdown** content!
$rawMarkdown = $document->getContent();

// To get the converted HTML content..
// <p>This is my <strong>markdown</strong> content!</p>
$html = $document->getHtmlContent();

// To access the full array of metadata
// array(
//      'title'     => 'This is my document title.',
//      'slug'      => 'this-is-the-slug',
//      'date'      => '12th December 1984'
// );
$metadata = $document->get();

// To access a piece of metadata by key (default: null)..
// this-is-the-slug
$slug = $document->get('slug');

Origin

Kurenai is a forked project from daylerees/kurenai.

About

๐Ÿ“‘ Kurenai is a Markdown document parser which allows for extra metadata to be associated with the document.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages