[ 'disallowed_tags' => [ 'title', 'textarea', 'style', 'xmp', 'iframe', 'noembed', 'noframes', 'script', 'plaintext' ], ], 'table_of_contents' => [ 'html_class' => 'table-of-contents', 'min_heading_level' => 2, 'max_heading_level' => 6, 'normalize' => 'relative', 'placeholder' => null, ], 'heading_permalink' => [ 'html_class' => '', 'apply_id_to_heading' => false, 'min_heading_level' => 2, 'max_heading_level' => 6, 'symbol' => '', ], 'table' => [ 'wrap' => [ 'enabled' => false, 'tag' => 'div', 'attributes' => [], ], 'alignment_attributes' => [ 'left' => ['align' => 'left'], 'center' => ['align' => 'center'], 'right' => ['align' => 'right'], ], ], 'mentions' => [ 'tag_handle' => [ 'prefix' => '#', 'pattern' => '[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(?!\w)', 'generator' => '/tag/%s', ] ], 'external_link' => [ 'internal_hosts' => 'site.knah-tsaeb.local', // TODO: Don't forget to set this! 'open_in_new_window' => true, 'html_class' => 'external-link', 'nofollow' => '', 'noopener' => 'external', 'noreferrer' => 'external', ], ]; $environment = new Environment($config); $environment->addExtension(new CommonMarkCoreExtension()); $environment->addExtension(new MentionExtension()); $environment->addExtension(new TableExtension()); $environment->addExtension(new TableOfContentsExtension()); $environment->addExtension(new ExternalLinkExtension()); $environment->addExtension(new HeadingPermalinkExtension()); $environment->addExtension(new DisallowedRawHtmlExtension()); $converter = new MarkdownConverter($environment); return $converter->convert($content); } }