API Documentation

ShortcodeProcessor
in package
implements MarkdownPreProcessorContract

Handle all shortcode processing for a Markdown conversion.

The shortcode system has a few limitations, as it is meant to be simple by design so that it is easy to understand how the code works, and what each shortcode does. Shortcodes are expanded on a per-line basis, and do not support multi-line input. Shortcodes are expected to be the very first thing on a line. The signature is a static string that is used to identify the shortcode. The built-in shortcodes do not use regex, as that would make them harder to read.

Tags
phpstan-consistent-constructor

Table of Contents

Interfaces

MarkdownPreProcessorContract
Process Markdown before it is converted to HTML.

Properties

$input  : string
The input Markdown document body.
$output  : string
The processed Markdown document body.
$shortcodes  : array<string, MarkdownShortcodeContract>
The activated shortcode instances.

Methods

preprocess()  : string
discoverShortcodes()  : void
discoverSignature()  : string
expandShortcode()  : string
getOutput()  : string
processInput()  : static

Properties

Methods

preprocess()

public static preprocess(string $markdown) : string
Parameters
$markdown : string

Markdown to be processed

Return values
string

$markdown Processed Markdown output

discoverSignature()

protected discoverSignature(string $line) : string
Parameters
$line : string
Return values
string

expandShortcode()

protected expandShortcode(string $line) : string
Parameters
$line : string
Return values
string

        
On this page

Search results