You are here

public static function TableOfContentsExtension::defaultSettings in Markdown 8.2

Provides the default settings for the plugin.

Parameters

\Drupal\markdown\Annotation\InstallablePlugin $pluginDefinition: The plugin definition.

Return value

array The default settings.

Overrides SettingsTrait::defaultSettings

File

src/Plugin/Markdown/CommonMark/Extension/TableOfContentsExtension.php, line 48

Class

TableOfContentsExtension
Plugin annotation @MarkdownExtension( id = "commonmark-table-of-contents", label = @Translation("Table Of Contents"), description = @Translation("Automatically inserts a table of contents into your document with links to the various…

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark\Extension

Code

public static function defaultSettings($pluginDefinition) {

  /* @var \Drupal\markdown\Annotation\InstallablePlugin $pluginDefinition */
  $settings = [
    'html_class' => 'table-of-contents',
    'max_heading_level' => 6,
    'min_heading_level' => 1,
    'normalize' => 'relative',
    'position' => 'top',
    'style' => 'bullet',
  ];

  // Support placeholder feature if it exists (1.5.0+).
  // @see https://github.com/thephpleague/commonmark/pull/466
  if (static::featureExists('placeholder')) {
    $settings['position'] = 'placeholder';
    $settings['placeholder'] = '[TOC]';
  }
  return $settings;
}