HumHub Documentation (unofficial)

BaseMarkdown
in package

BaseMarkdown provides concrete implementation for [[Markdown]].

Do not use BaseMarkdown. Use [[Markdown]] instead.

Tags
author

Carsten Brandt mail@cebe.cc

since
2.0

Table of Contents

Properties

$defaultFlavor  : string
$flavors  : array<string|int, mixed>

Methods

process()  : string
Converts markdown into HTML.
processParagraph()  : string
Converts markdown into HTML but only parses inline elements.
getParser()  : Parser

Properties

$defaultFlavor

public static string $defaultFlavor = 'original'

the markdown flavor to use when none is specified explicitly. Defaults to original.

Tags
see
flavors

$flavors

public static array<string|int, mixed> $flavors = ['original' => ['class' => 'cebe\markdown\Markdown', 'html5' => true], 'gfm' => ['class' => 'cebe\markdown\GithubMarkdown', 'html5' => true], 'gfm-comment' => ['class' => 'cebe\markdown\GithubMarkdown', 'html5' => true, 'enableNewlines' => true], 'extra' => ['class' => 'cebe\markdown\MarkdownExtra', 'html5' => true]]

a map of markdown flavor names to corresponding parser class configurations.

Methods

process()

Converts markdown into HTML.

public static process(string $markdown[, string|null $flavor = null ]) : string
Parameters
$markdown : string

the markdown text to parse

$flavor : string|null = null

the markdown flavor to use. See [[$flavors]] for available values. Defaults to [[$defaultFlavor]], if not set.

Tags
throws
InvalidArgumentException

when an undefined flavor is given.

Return values
string —

the parsed HTML output

processParagraph()

Converts markdown into HTML but only parses inline elements.

public static processParagraph(string $markdown[, string|null $flavor = null ]) : string

This can be useful for parsing small comments or description lines.

Parameters
$markdown : string

the markdown text to parse

$flavor : string|null = null

the markdown flavor to use. See [[$flavors]] for available values. Defaults to [[$defaultFlavor]], if not set.

Tags
throws
InvalidArgumentException

when an undefined flavor is given.

Return values
string —

the parsed HTML output

getParser()

protected static getParser(string|null $flavor) : Parser
Parameters
$flavor : string|null

the markdown flavor to use. See [[$flavors]] for available values. Defaults to [[$defaultFlavor]], if not set.

Tags
throws
InvalidArgumentException

when an undefined flavor is given.

Return values
Parser

        
On this page

Search results