API Documentation

Markdown
in package
implements Arrayable, Stringable, Htmlable

A simple object representation of a Markdown file, with helpful methods to interact with it.

Table of Contents

Interfaces

Arrayable
Stringable
Htmlable

Properties

$body  : string

Methods

__construct()  : mixed
Create a new Markdown object from a string.
__toString()  : string
Get the source Markdown body.
body()  : string
Get the source Markdown body.
compile()  : string
Compile the Markdown body to a string of HTML.
fromFile()  : static
Parse a Markdown file into a new Markdown object.
render()  : string
Render a Markdown string into HTML.
toArray()  : array<string|int, string>
Get the Markdown document body as an array of lines.
toHtml()  : HtmlString
Same as Markdown::compile(), but returns an HtmlString object.

Properties

Methods

__construct()

Create a new Markdown object from a string.

public __construct([string $body = '' ]) : mixed
Parameters
$body : string = ''

__toString()

Get the source Markdown body.

public __toString() : string
Return values
string

body()

Get the source Markdown body.

public body() : string
Return values
string

compile()

Compile the Markdown body to a string of HTML.

public compile([HydePage>|null $pageClass = null ]) : string

If the Markdown being compiled is from a page model, supply model's class name here so the dynamic parser can be used.

Parameters
$pageClass : HydePage>|null = null
Return values
string

fromFile()

Parse a Markdown file into a new Markdown object.

public static fromFile(string $path) : static
Parameters
$path : string
Return values
static

render()

Render a Markdown string into HTML.

public static render(string $markdown[, string|null $pageClass = null ]) : string

If a source model is provided, the Markdown will be converted using the dynamic MarkdownService, otherwise, the pre-configured singleton from the service container will be used instead.

Parameters
$markdown : string
$pageClass : string|null = null
Return values
string

$html

toArray()

Get the Markdown document body as an array of lines.

public toArray() : array<string|int, string>
Return values
array<string|int, string>

toHtml()

Same as Markdown::compile(), but returns an HtmlString object.

public toHtml([string|null $pageClass = null ]) : HtmlString
Parameters
$pageClass : string|null = null
Return values
HtmlString

        
On this page

Search results