定制 imatic-it/imatic-formatting 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imatic-it/imatic-formatting

Composer 安装命令:

composer require imatic-it/imatic-formatting

包简介

README 文档

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' => 'markdown', // '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

User mentions (autocomplete)

When typing @ in any supported text area, the plugin shows an autocomplete dropdown of assignable users in the current project so you can quickly insert @username mentions. The user list is derived from MantisBT's assignee selector (select[name="handler_id"]), so only users that can be set as a handler in the current project context are offered — special pseudo-entries such as [Myself] and [Reporter] are filtered out.

Supported text areas (both plain and ToastUI/WYSIWYG mode):

  • #summary
  • #description
  • #steps_to_reproduce
  • #additional_info, #additional_information
  • #bugnote_text

The autocomplete UI is powered by Tribute.js (bundled, no runtime CDN).

Mention rendering and notifications are handled by MantisBT core: after the markdown converter runs, the plugin pipes the output through mention_format_text(), which turns @username into a clickable link and (when $g_enable_user_mention is enabled in MantisBT config) sends the standard mention notification to that user. See the MantisBT User Mention configuration for the notification settings.

Preview Test Pages

The plugin provides test pages where you can see how your Markdown and HTML formatting will be rendered before using it in actual issues.

  1. Navigate to the Plugin Configuration Page: Manage -> Manage Plugins -> Imatic Formatting

  2. Click on "Test Issue Formatting Preview" or open directly: /plugin.php?page=ImaticFormatting/test-issue-previews.php

  3. You will find several preview sections:

    • 📧 HTML Rendered Preview – see how HTML emails will render
    • 📝 Plain Text Preview – view the plain text formatting
    • ⚠️ Broken Format Preview – simulate text without plugin formatting
    • 🔗 Link Rendering & Query Parameters – test links including query strings and & characters
    • 🖋️ Markdown Preview – test all Markdown elements including headings, lists, blockquotes, code blocks, tables, images, links, and horizontal rules

This is useful for verifying your formatting rules, link handling, WYSIWYG editor integration, and Markdown rendering be

统计信息

  • 总下载量: 595
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2020-08-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固