class Markdown

Properties

protected string $theme

The current theme being used when generating emails.

protected array $componentPaths

The registered component paths.

static protected bool $withSecuredEncoding

Indicates if secure encoding should be enabled.

static protected ExtensionInterface>> $extensions

The registered CommonMark extensions.

Methods

__construct(Factory $view, array $options = [])

Create a new Markdown renderer instance.

render(string $view, array $data = [], mixed $inliner = null, string|null $theme = null)

Render the Markdown template into HTML.

renderText(string $view, array $data = [])

Render the Markdown template into text.

static HtmlString
parse(Stringable|string $text, bool $encoded = false)

Parse the given Markdown text into HTML.

static MarkdownConverter
converter(array $config = [])

Get a Markdown converter instance.

array
htmlComponentPaths()

Get the HTML component paths.

array
textComponentPaths()

Get the text component paths.

viewFactoryWithMailNamespace(array $paths)

Clone the view factory with render-local mail component paths.

array
componentPaths()

Get the component paths.

void
loadComponentsFrom(array $paths = [])

Register new mail component paths.

theme(string $theme)

Set the default theme to be used.

string
getTheme()

Get the theme currently being used by the renderer.

static void
withSecuredEncoding()

Enable secured encoding when parsing Markdown.

static void
withoutSecuredEncoding()

Disable secured encoding when parsing Markdown.

static void
flushState()

Flush all static state.

Details

at line 46
__construct(Factory $view, array $options = [])

Create a new Markdown renderer instance.

Parameters

Factory $view
array $options

at line 59
HtmlString render(string $view, array $data = [], mixed $inliner = null, string|null $theme = null)

Render the Markdown template into HTML.

Parameters

string $view
array $data
mixed $inliner
string|null $theme

Return Value

HtmlString

at line 111
HtmlString renderText(string $view, array $data = [])

Render the Markdown template into text.

Parameters

string $view
array $data

Return Value

HtmlString

at line 125
static HtmlString parse(Stringable|string $text, bool $encoded = false)

Parse the given Markdown text into HTML.

Parameters

Stringable|string $text
bool $encoded

Return Value

HtmlString

at line 155
static MarkdownConverter converter(array $config = [])

internal  
 

Get a Markdown converter instance.

Parameters

array $config

Return Value

MarkdownConverter

at line 174
array htmlComponentPaths()

Get the HTML component paths.

Return Value

array

at line 184
array textComponentPaths()

Get the text component paths.

Return Value

array

at line 194
protected Factory viewFactoryWithMailNamespace(array $paths)

Clone the view factory with render-local mail component paths.

Parameters

array $paths

Return Value

Factory

at line 208
protected array componentPaths()

Get the component paths.

Return Value

array

at line 221
void loadComponentsFrom(array $paths = [])

Register new mail component paths.

Boot-only. Mutates the shared Markdown renderer's component paths; use scoped view namespaces for per-render component path changes.

Parameters

array $paths

Return Value

void

at line 232
Markdown theme(string $theme)

Set the default theme to be used.

Boot-only. Mutates the shared Markdown renderer's default theme; pass a per-render theme to render() for message-specific themes.

Parameters

string $theme

Return Value

Markdown

at line 242
string getTheme()

Get the theme currently being used by the renderer.

Return Value

string

at line 253
static void withSecuredEncoding()

Enable secured encoding when parsing Markdown.

Boot-only. The flag persists in a static property for the worker lifetime and applies to every subsequent Markdown render across all coroutines.

Return Value

void

at line 264
static void withoutSecuredEncoding()

Disable secured encoding when parsing Markdown.

Boot-only. The flag persists in a static property for the worker lifetime and applies to every subsequent Markdown render across all coroutines.

Return Value

void

at line 272
static void flushState()

Flush all static state.

Return Value

void