final class MarkdownDocument

Reads a definition written as Markdown cards and writes it back in the same form.

The YAML frontmatter holds the version and source; each top-level heading is an item ID followed by badges, a statement, quoted evidence and bold field sections. What the author chose beyond the data model, such as badge images and link targets, is remembered so that formatting reproduces it.

Methods§

public function __construct()

Starts with nothing remembered; each read replaces what the previous one remembered.

Calls 1
public function read(
    string $file,
    array<string, mixed> $options,
    string|null $directory = null,
): stdClass

Reads a Markdown definition into the same shape as a YAML definition.

Parameters

$filestringThe definition file
$optionsarray<string, mixed>The markdown options; experimental must be true
$directorystring|nullThe configuration directory that the source URI resolves against

Returns

stdClass The definition with its items

Throws

InvalidInputException When Markdown is not enabled or the document breaks the card syntax
JsonException When the source cannot be converted
ParseException When the frontmatter is malformed YAML
Test cases 10
Called from 1
Calls 20
public function references(): list<Reference>

Returns the links to other items found by the last read.

Returns

list<Reference> The links, checked once every definition is loaded
Test cases 1
public function render(stdClass $data): string

Writes a definition as Markdown cards, reusing what the last read remembered.

Parameters

$datastdClassThe definition

Returns

string The Markdown text

Throws

InvalidInputException When a record cannot be written as a card
JsonException When a metadata value cannot be encoded
Test cases 5
Calls 2

Private surface 2§

Implementation details, listed for orientation only.

private Presentation $presentation
private ?Citation $source = null

Test cases 26§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 11
Other tests reaching this symbol 15

Relations§

Instantiated in 1
Method calls 1
Type declarations 1