Index

DocGenerator

MMO\client · 1 symbol · generated 30 Sep 2026

class

DocGenerator

DocGenerator.php:15

Generates the complete HTML documentation from a JSON file

class MMO\client\DocGenerator
Namespace
MMO\client
How to use : $generator = new DocGenerator(); $jsonFile = '/doc_example.json'; $html = $generator->generate($jsonFile); unlink($jsonFile); echo $html;

Index

allowedTags
generate($jsonFile)Generates the complete HTML documentation from a JSON file
renderCodeBlock($section)Renders a code block
renderCustomElement($section)Renders the documentation of a Custom Element
renderDemo($section)Generates a demo
renderParagraph($section)If the paragraph is ordered, render an ordered list If the paragraph is a heading, render a heading Otherwise, render a paragraph with inline HTML allowed
renderSection($section, $opts)Renders a section according to its type
sanitizeInlineHtml($content)Sanitizes inline HTML

Properties1

allowedTags

array $allowedTags = ['code', 'pre', 'strong', 'em', 'a', 'span', 'br']
Type
array

Methods7

generate($jsonFile)

DocGenerator.php:23

Generates the complete HTML documentation from a JSON file

function generate(string $jsonFile): string
$jsonFilestring: path to the JSON file
returnsstring

renderCodeBlock($section)

DocGenerator.php:111

Renders a code block

protected function renderCodeBlock(array $section): string
$sectionarray: accepts the following keys: - code string : code to display - title string : title of the code block
returnsstring

renderCustomElement($section)

DocGenerator.php:130

Renders the documentation of a Custom Element

protected function renderCustomElement(array $section): string
$sectionarray: accepts the following keys: - tag string : tag of the custom element - description string : description of the custom element - css array : CSS classes to display - attributes array : attributes of the custom element - methods array : methods of the custom element - content array : content of the custom element
returnsstring

renderDemo($section)

DocGenerator.php:240

Generates a demo

protected function renderDemo(array $section): string
$sectionarray: accepts the following keys: - horizontal boolean : if true, the demo is horizontal - example string : HTML code of the demo
returnsstring

renderParagraph($section)

DocGenerator.php:77

If the paragraph is ordered, render an ordered list If the paragraph is a heading, render a heading Otherwise, render a paragraph with inline HTML allowed

protected function renderParagraph(array $section): string
$sectionarray: accepts the following keys: - content string : content of the paragraph - ordered boolean : if true, the paragraph is an ordered list - headingLevel integer : if defined, the paragraph is a heading - classes string : CSS classes to apply to the paragraph
returnsstring

renderSection($section, $opts)

DocGenerator.php:53

Renders a section according to its type

protected function renderSection(array $section, array $opts = []): string
$sectionarray: accepts the following keys: - type string : type of the section - demo array : demo of the section - code-block array : code block of the section - custom-element array : custom element of the section - paragraph array : paragraph of the section
$opts = []array
returnsstring

sanitizeInlineHtml($content)

DocGenerator.php:251

Sanitizes inline HTML

protected function sanitizeInlineHtml(string $content): string
$contentstring: content to sanitize
returnsstring