This is the documentation for the unsupported version 1.4. Please consider upgrading your code to the latest stable version

Configuration

You can provide an array of configuration options to the CommonMarkConverter when creating it:

use League\CommonMark\CommonMarkConverter;

$converter = new CommonMarkConverter([
    'renderer' => [
        'block_separator' => "\n",
        'inner_separator' => "\n",
        'soft_break'      => "\n",
    ],
    'enable_em' => true,
    'enable_strong' => true,
    'use_asterisk' => true,
    'use_underscore' => true,
    'unordered_list_markers' => ['-', '*', '+'],
    'html_input' => 'escape',
    'allow_unsafe_links' => false,
    'max_nesting_level' => INF,
]);

Here’s a list of currently-supported options:

Additional configuration options are available for some of the available extensions - refer to their individual documentation for more details.

Environment

The configuration is ultimately passed to (and managed via) the Environment. If you’re creating your own Environment, simply pass your config array into its constructor instead.

The Environment also exposes three methods for managing the configuration:

Learn more about customizing the Environment


Edit this page