czukowski/markdown-tables

RST Grid Tables parser for cebe/markdown

1.0.4 2016-10-26 13:24 UTC

This package is auto-updated.

Last update: 2024-04-06 08:44:10 UTC


README

This package adds support for reStructuredText's (RST) Grid Tables syntax to cebe's Markdown implementation.

The motivation behind it is that technical documentation often requires a support for tables that are complex, can span rows and columns and contain block elements. Grid Tables for RST provide that, even though they're harder to type than other table implementations in Markdown.

The current implementation is a port of Grid Tables parser from Docutils module originally written in Python by David Goodger. Note that Docutils's scope is far greater than Grid Tables and my intention was not to replicate all of it. One considered extension is eventually adding support for Simple Tables syntax, especially since the current code structure makes it relatively easy task.

Installation

Recommended installation is via composer by running:

composer require czukowski/markdown-tables "~1.0"

Alternatively you may add the following to the require section of your project's composer.json manually and then run composer update from the command line:

"czukowski/markdown-tables: "~1.0"

Usage

This package provides a RSTTableBlockTrait that may be used in classes extending the cebe's original Markdown parsers.

Alternatively, three extensions are provided for easy use (pick one that suits best):

use Cz\Markdown;

$markdownWithRSTTables = new MarkdownWithRSTTables;
$githubMarkdownWithRSTTables = new GithubMarkdownWithRSTTables;
$markdownExtraWithRSTTables = new MarkdownExtraWithRSTTables;

For more information refer to the original Readme file.

Known Issues

If the tables seem broken, make sure a correct default encoding is set beforehand, for example:

// Set default encoding to UTF-8.
mb_internal_encoding('UTF-8');

License

The distribution is permitted under the MIT License. See LICENSE.md for details.