MMOframework
Why AI Playground Libraries Developers Agency
FR EN
Build a project live
Index

Markdown

MMO\core\helpers · 1 symbol · generated 30 Nov 2026

class

Markdown

Markdown.php:11

Writing Markdown (GitHub's flavour) from what a document holds: a value made text, a table, a line escaped. What the readers of Office files and PDFs write their text with (Document::toMarkdown,

class MMO\core\helpers\Markdown
Namespace
MMO\core\helpers
See
Document::toMarkdown, mmo.pdf's PdfReader).
echo Markdown::Table([['Name', 'Age'], ['Marc', 42]]);

Index

Cell($value) staticA table cell: escaped, on one line (its line breaks become <br>).
Escape($text) staticEscape what Markdown would read as markup in a line of text: emphasis, code, links, html, and a line starting as a heading, a list or a quote.
FrontMatter($values) staticA YAML front matter, between its --- lines: each value written as JSON, which YAML reads; an array of keys one level down.
Inline($text) staticEscape what Markdown would read as markup anywhere in a line (emphasis, code, links, html): a piece of a line, whose start is not the line's.
Table($rows, $raw) staticA table. The first row is its header; every row is made as long as the longest.
Value($value) staticA value as text: a date as Y-m-d (with its time when it has one), a boolean as TRUE/FALSE, a float without its binary noise.

Methods6

Cell($value)

staticMarkdown.php:52

A table cell: escaped, on one line (its line breaks become <br>).

static function Cell(mixed $value): string
$valuemixed
returnsstring
Markdown::Cell("a|b\nc"); // 'a\|b<br>c'

Escape($text)

staticMarkdown.php:34

Escape what Markdown would read as markup in a line of text: emphasis, code, links, html, and a line starting as a heading, a list or a quote.

static function Escape(string $text): string
$textstring
returnsstring
Markdown::Escape('*not bold*'); // '\*not bold\*'

FrontMatter($values)

staticMarkdown.php:89

A YAML front matter, between its --- lines: each value written as JSON, which YAML reads; an array of keys one level down.

static function FrontMatter(array $values): string
$valuesarray
returnsstring
Markdown::FrontMatter(['source' => 'a.pdf', 'pages' => 2]); // "---\nsource: \"a.pdf\"\npages: 2\n---\n\n"

Inline($text)

staticMarkdown.php:44

Escape what Markdown would read as markup anywhere in a line (emphasis, code, links, html): a piece of a line, whose start is not the line's.

static function Inline(string $text): string
$textstring
returnsstring
Markdown::Inline('a_b'); // 'a\_b'

Table($rows, $raw)

staticMarkdown.php:64

A table. The first row is its header; every row is made as long as the longest.

static function Table(array $rows, bool $raw = false): string
$rowsarrayeach row's cells, already made Markdown when $raw.
$raw = falseboolthe cells are Markdown already (links...): only their line breaks and pipes are made safe.
returnsstring
Markdown::Table([['Name', 'Age'], ['Marc', 42]]);

Value($value)

staticMarkdown.php:17

A value as text: a date as Y-m-d (with its time when it has one), a boolean as TRUE/FALSE, a float without its binary noise.

static function Value(mixed $value): string
$valuemixed
returnsstring
Markdown::Value(new \DateTime('2026-11-30')); // '2026-11-30'