2017 © Pedro Peláez
 

library mmb

Minimalist markdown blogging tool

image

cammanderson/mmb

Minimalist markdown blogging tool

  • Monday, August 18, 2014
  • by cammanderson
  • Repository
  • 1 Watchers
  • 1 Stars
  • 99 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Minimalist Markdown Blog

Focus on writing clean blog articles using simple markdown. Include beautiful colourful fenced code blocks that people will love., (*1)

Minimalistic approach, based on silex. Chose where to store and retrieve your markdown, I'm using a separate git repository. Articles are pushed here and mapped by the FileArticleService., (*2)

Usage

For your application:, (*3)

  • Add to your composer
  • Add to your Silex application
  • Install Pygments
  • Specify the pygmentize bin
  • Specify the path to the articles (default file provider)

Composer

{
    "require": {
        "cammanderson/mmb" : "dev-master"
    }
}

Silex Service Provider and Route

You can add the article service and then use it in your application as needed., (*4)

...
$app->register(new MMB\ArticleServiceProvider());
...
// Controller
$articleController = function (Silex\Application $app, MMB\Article $article) {
    return $app['twig']->render('article.html.twig', array(
            'article' => $article,
            'highlighter' => $app['markdown_parser_highlighter']
        ));
};

// Add the article route
$app->get('/article/{article}', function (MMB\Article $article) use ($app, $articleController) {
    return $articleController($app, $article);
})->assert('article', '.+')
->convert('article', 'article_service:getArticle');
...

Default Configuration

Currently needs a couple of elements set to app['config']['parameters'], (*5)

parameters:
    mmb_file_path: ../content
    pygments_bin: /opt/local/bin/pygmentize-2.7

Consider using a YAML config provider for silex deralex/yaml-config-service-provider, (*6)

Writing Articles

Using the FileArticleService, it will take a configuration path to look for files. Articles are mapped by key, where the key matches the filename., (*7)

2014-08-10_my-article.md
2014-08-12_my-other-article.md

Hosting articles on github

It is easily possible to place the articles in your github repository and connect to it using GithubService for mmd., (*8)

Extending

Alternative location for Articles

You can always implement your own ArticleService to source the articles from another location., (*9)

class MyArticleService extends AbstractArticleService
{
    public function getArticle($key)
    {
        // TODO: Implement your own method to locate the article
        $articleContents = '...';

        // Create the article
        $article = $this->provider->provide($key, $articleContents);

        // ... Apply further properties your Service supports

        // Return
        return $article;
    }
}

Now register to the dependency injector (remember to provider the article provider)., (*10)

$app['article_service'] = $app->share(function ($app) {
    $service = new MyArticleService();
    $service->setProvider($app['article_provider']);
    return $service;
});

TODO

Eventually to be moved to MCB (Minimalist Coders Blog) for more broader use. Developers can then implement their own article providers (file, git, cmf etc), formating and highlighters (e.g. pygments, geshi etc)., (*11)

  • Add various traits to article to support dates, author, version, changelog etc
  • Implement a GitArticleService/GitHubArticleService that interrogates git for author, versions, etc
  • Implement a better configuration layout
  • Implement ArticleService list commands, allowing listings of blog history
  • Possible Symfony2 support via DI/Service container config
  • Implement geshi/sundown/restructedtext etc.

The Versions

18/08 2014

dev-master

9999999-dev

Minimalist markdown blogging tool

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Cameron Manderson

markdown blog coding

18/08 2014

v1.0-alpha

1.0.0.0-alpha

Minimalist markdown blogging tool

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Cameron Manderson

markdown blog coding

16/08 2014

dev-develop

dev-develop

Minimalist markdown blogging tool

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Cameron Manderson

markdown blog coding