MarkdownService
in package
uses
SetsUpMarkdownConverter
Dynamically creates a Markdown converter tailored for the target model and setup, then converts the Markdown to HTML using both pre- and post-processors.
Table of Contents
Properties
- $config : array<string|int, mixed>
- $converter : MarkdownConverter
- $extensions : array<string|int, ExtensionInterface>>
- $features : array<string|int, mixed>
- $html : string
- $markdown : string
- $pageClass : string|null
- $postprocessors : array<string|int, MarkdownPostProcessorContract>>
- $preprocessors : array<string|int, MarkdownPreProcessorContract>>
Methods
- __construct() : mixed
- addExtension() : void
- addFeature() : static
- canEnablePermalinks() : bool
- canEnableTorchlight() : bool
- getExtensions() : array<string|int, mixed>
- hasFeature() : bool
- isDocumentationPage() : bool
- normalizeIndentationLevel() : string
- Normalize indentation for an un-compiled Markdown string
- parse() : string
- removeFeature() : static
- withPermalinks() : static
- withTableOfContents() : static
- configurePermalinksExtension() : void
- determineIfTorchlightAttributionShouldBeInjected() : bool
- enableAllHtmlElements() : void
- findLineContentPositions() : array<int, int>
- Find the indentation level and position of the first line that has content.
- getNormalizedLines() : array<int, string>
- injectTorchlightAttribution() : string
- runPostProcessing() : void
- runPreProcessing() : void
- setupConverter() : void
Properties
$config
protected
array<string|int, mixed>
$config
= []
$converter
protected
MarkdownConverter
$converter
$extensions
protected
array<string|int, ExtensionInterface>>
$extensions
= []
$features
protected
array<string|int, mixed>
$features
= []
$html
protected
string
$html
$markdown
protected
string
$markdown
$pageClass
protected
string|null
$pageClass
= null
$postprocessors
protected
array<string|int, MarkdownPostProcessorContract>>
$postprocessors
= []
$preprocessors
protected
array<string|int, MarkdownPreProcessorContract>>
$preprocessors
= []
Methods
__construct()
public
__construct(string $markdown[, string|null $pageClass = null ]) : mixed
Parameters
- $markdown : string
- $pageClass : string|null = null
addExtension()
public
addExtension(string $extensionClassName) : void
Parameters
- $extensionClassName : string
addFeature()
public
addFeature(string $feature) : static
Parameters
- $feature : string
Return values
staticcanEnablePermalinks()
public
canEnablePermalinks() : bool
Return values
boolcanEnableTorchlight()
public
canEnableTorchlight() : bool
Return values
boolgetExtensions()
public
getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>hasFeature()
public
hasFeature(string $feature) : bool
Parameters
- $feature : string
Return values
boolisDocumentationPage()
public
isDocumentationPage() : bool
Return values
boolnormalizeIndentationLevel()
Normalize indentation for an un-compiled Markdown string
public
static normalizeIndentationLevel(string $string) : string
Parameters
- $string : string
Return values
stringparse()
public
parse() : string
Return values
stringremoveFeature()
public
removeFeature(string $feature) : static
Parameters
- $feature : string
Return values
staticwithPermalinks()
public
withPermalinks() : static
Return values
staticwithTableOfContents()
public
withTableOfContents() : static
Return values
staticconfigurePermalinksExtension()
protected
configurePermalinksExtension() : void
determineIfTorchlightAttributionShouldBeInjected()
protected
determineIfTorchlightAttributionShouldBeInjected() : bool
Return values
boolenableAllHtmlElements()
protected
enableAllHtmlElements() : void
findLineContentPositions()
Find the indentation level and position of the first line that has content.
protected
static findLineContentPositions(array<int, string> $lines) : array<int, int>
Parameters
- $lines : array<int, string>
Return values
array<int, int>getNormalizedLines()
protected
static getNormalizedLines(string $string) : array<int, string>
Parameters
- $string : string
Return values
array<int, string>injectTorchlightAttribution()
protected
injectTorchlightAttribution() : string
Return values
stringrunPostProcessing()
protected
runPostProcessing() : void
runPreProcessing()
protected
runPreProcessing() : void
setupConverter()
protected
setupConverter() : void