imatic-it/imatic-formatting

v0.0.5 2021-01-08 07:49 UTC

This package is auto-updated.

Last update: 2025-07-09 08:06:46 UTC


README

License: GPL-2.0-or-later

Imatic formatting

Purpose

Converts markdown into html.

Installation

composer config --unset platform.php
composer require imatic-it/imatic-formatting

Code highlighting

Following url was used to fetch code highlighting code: https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+clojure+markup-templating+php+sql

It can be disabled with:

$g_plugin_ImaticFormatting_include_prism = false;

ToastUI Editor (WYSIWYG)

This plugin integrates ToastUI Editor to provide a modern WYSIWYG and Markdown editor for text areas in MantisBT.

You can enable or configure the editor in your plugin config. Example:

public function config(): array
{
    return [
        'include_prism' => true,
        'toastui_editor' => [
            'enabled' => true,
            'textAreas'=> [
                'description',
                'additional_info',
                'additional_information',
                'bugnote_text'
            ],
            'options' => [
                'initialEditType' => 'wysiwyg', // 'markdown' or 'wysiwyg'
                'previewStyle' => 'tab', // 'tab' or 'vertical'
                'height' => false, // Use false for default height
                'useDefaultHTMLSanitizer' => true,
                'useCommandShortcut' => true,
                'useDefaultHTMLSanitizerOptions' => [
                    'allowAttributes' => ['class', 'style'],
                    'allowTags' => ['a', 'b', 'i', 'strong', 'em', 'p', 'br', 'ul', 'ol', 'li', 'code', 'pre'],
                ],
            ],
        ]
    ];
}

Features

  • Markdown and WYSIWYG editing mode
  • Live preview (tab or vertical split)
  • Custom HTML sanitization with DOMPurify
  • Optional keyboard shortcuts
  • Automatic synchronization with MantisBT text areas