BenjaminHoegh / ParsedownExtended

ParsedownExtended is an extention for Parsedown, offering additional features and functionalities.
https://benjaminhoegh.github.io/ParsedownExtended
MIT License
37 stars 7 forks source link

v1.2.0 Docs information #38

Closed BenjaminHoegh closed 8 months ago

BenjaminHoegh commented 2 years ago

Not done with the new docs yet but here is some info about the new settings:

setSetting Method

The setSetting method allows you to set a setting value for the ParsedownExtended instance. It is designed to be chainable, allowing you to easily configure settings.

Method Signature

public function setSetting(string $settingName, $settingValue): self

Parameters

Return Value

The method returns the current instance of the ParsedownExtended class, which allows for method chaining.

Usage Examples

$Parsedown = new ParsedownExtended();

// Example 1: Updating a boolean setting 'code' to true
$Parsedown->setSetting('code', true);

// Example 2: Updating a boolean setting 'emphasis.subscript' to true
$Parsedown->setSetting('emphasis.subscript', true);

// Example 3: Updating a setting with an array value while preserving 'enabled'
$Parsedown->setSetting('math.block.delimiters', [
    ['left' => 'kk', 'right' => 'dd'],
    ['left' => '__', 'right' => '__']
]);

// Example 4: Updating a setting value with method chaining
$Parsedown
    ->setSetting('headings.allowed', ['h1', 'h2'])
    ->setSetting('links.enabled', true);