The Markdown Support Plugin adds full Markdown formatting capabilities to osTicket 1.18.x ticket threads. It provides a user-friendly editor interface with live preview, toolbar buttons, keyboard shortcuts, and automatic format detection for API-created tickets.
Perfect for technical support teams who need to format code snippets, create structured documentation, or prefer Markdown's simplicity over traditional WYSIWYG editors.
| Component | Version | Note |
|---|---|---|
| osTicket | 1.18.x | Required (uses ThreadEntryBody class) |
| PHP | 7.4+ | Recommended: PHP 8.1+ |
| jQuery | Any | Included in osTicket |
| Parsedown | 1.7+ | Bundled with plugin |
Choose one of the following methods:
osticket-markdown-support-vX.X.X.zipmarkdown-support folder to /include/plugins/ on your osTicket servercd /path/to/osticket/include/plugins
git clone https://github.com/markus-michalski/osticket-markdown-support.git markdown-support
chmod 755 /path/to/osticket/include/plugins/markdown-support
chmod 644 /path/to/osticket/include/plugins/markdown-support/*.php
The plugin automatically configures static asset access by updating /include/.htaccess.
| Setting | Description | Default | Use When |
|---|---|---|---|
| Enable Markdown Support | Globally enable/disable Markdown | ✅ On | You want to temporarily disable Markdown |
| Default Thread Entry Format | Default format for new entries | Markdown | You want Text or HTML as default |
| Allow Format Switching | Users can switch between formats | ✅ On | You want to lock format |
| Auto-Convert Markdown Syntax | Auto-detect Markdown patterns | ❌ Off | You create tickets via API without format parameter |
| Show Live Preview | Display real-time preview pane | ✅ On | Preview causes performance issues |
| Show Markdown Toolbar | Show formatting buttons | ✅ On | Users are Markdown experts |
For Technical Teams:
format parameter in API)For API-Heavy Workflows:
For Mixed Teams (Markdown + HTML users):
The Markdown toolbar provides quick access to common formatting:
| Button | Markdown Syntax | Keyboard Shortcut | Output |
|---|---|---|---|
| B | **text** |
Ctrl+B | Bold text |
| I | *text* |
Ctrl+I | Italic text |
| H | ## text |
Ctrl+H | Heading (cycles H1-H6) |
| 🔗 | [text](url) |
Ctrl+K | Hyperlink |
<> |
`code` |
- | inline code |
{ } |
```lang\ncode\n``` |
- | Code block with syntax |
| • | - item |
- | Unordered list |
| 1. | 1. item |
- | Numbered list |
| " | > quote |
- | Blockquote |
| — | --- |
- | Horizontal rule |
The live preview pane updates automatically as you type (with 500ms debouncing for performance).
Layout:
Preview Position:
Use the standard osTicket API with the format parameter:
curl -X POST "https://yourdomain.com/api/tickets.json" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"subject": "Bug Report",
"message": "## Bug Description\\n\\n**Steps to Reproduce:**\\n1. Login\\n2. Click button\\n\\n```php\\n$code = \"example\";\\n```",
"format": "markdown",
"topicId": 1
}'
| Value | Description | Rendering |
|---|---|---|
"markdown" |
Markdown syntax | Parsedown → HTML |
"html" |
HTML content | Sanitized HTML |
"text" |
Plain text | Escaped text |
| (omitted) | Auto-detect if enabled | Based on plugin config |
If you cannot modify your API client to send format=markdown, enable "Auto-Convert Markdown Syntax" in plugin settings.
The plugin will detect Markdown patterns:
#, ##, ###)**text**, *text*)```)-, 1.)[text](url))Note: Auto-detection is pattern-matching, not perfect. Explicit format parameter is recommended.
Check:
chmod 755 on plugin directory, chmod 644 on PHP files/include/plugins/markdown-support/plugin.php exists and is readableTest:
ls -la /path/to/osticket/include/plugins/markdown-support/plugin.php
Cause: .htaccess not updated to allow static assets.
Fix:
/include/.htaccess contains:<FilesMatch "\.(js|css|map|json|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|otf)$">
Allow from all
</FilesMatch>
NGINX Users: See NGINX Configuration
Check:
format="markdown" in database (ost_thread_entry)vendor/Parsedown.php existstail -f /path/to/osticket/include/ost-errors.logCommon Errors:
Parsedown.php not found → Re-download plugin from releasesClass 'MarkdownThreadEntryBody' not found → Reload page, clear opcacheThreadEntryBody class not found → osTicket version mismatch (requires 1.18.x)The plugin uses MutationObserver to detect dynamically loaded textareas.
Debug Steps:
markdown-editor.js loads (200 OK)If still not working:
Cause: "Allow Format Switching" is disabled in plugin settings.
Fix: Admin Panel → Plugins → Configure "Markdown Support" → Enable "Allow Format Switching"
Check:
Performance Note: Preview updates every 500ms (debounced). If typing very fast, preview may lag slightly.
Plugin Type: ThreadEntryBody Extension (osTicket 1.18+)
Core Mechanism:
ThreadEntryBody class using PHP ReflectionMarkdownThreadEntryBody classFormat::sanitize()No Core Modifications:
User Input (Markdown)
↓
Save to Database (format="markdown")
↓
Render Thread Entry
↓
MarkdownThreadEntryBody::display()
↓
Parsedown::text($markdown)
↓
Format::sanitize($html)
↓
Display to User (Safe HTML)
2-Layer XSS Protection:
Parsedown SafeMode:
$parsedown = new Parsedown();
$parsedown->setSafeMode(true); // Escapes HTML in Markdown
osTicket Sanitization:
$html = $parsedown->text($markdown);
$safeHtml = Format::sanitize($html); // osTicket's HTML purifier
Result: Malicious scripts in Markdown are escaped and cannot execute.
No schema changes required. Uses existing ost_thread_entry table:
| Column | Type | Usage |
|---|---|---|
format |
varchar(16) | "markdown", "html", or "text" |
body |
longtext | Raw Markdown or HTML |
markdown-support/
├── plugin.php # Plugin metadata
├── config.php # Configuration form
├── class.MarkdownPlugin.php # Main plugin class
├── markdown-body.php # ThreadEntryBody extension
├── markdown-preview.php # AJAX preview endpoint
├── log-handler.php # Debug logging
├── vendor/Parsedown.php # Markdown parser (bundled)
├── css/markdown-editor.css # Editor styles
├── js/markdown-editor.js # Editor JavaScript
├── i18n/de_DE/... # German translation
└── tests/ # PHPUnit tests
Apache: Plugin automatically configures .htaccess (no action needed)
NGINX: Add to server block:
location ~* ^/include/plugins/markdown-support/(css|js)/.*\.(css|js|map)$ {
allow all;
access_log off;
expires 30d;
}
Rendering Performance:
Recommendations:
No. Markdown only works in thread entries (messages, responses, notes). Ticket subjects are plain text only.
Yes! Each thread entry has its own format field. You can have:
format="markdown"format="html"format="text"Use the format switcher to change format per entry.
No (not yet). Canned Responses use osTicket's WYSIWYG editor. Markdown support for Canned Responses is planned for a future version.
Yes. Markdown is converted to HTML before being sent via email, so recipients see formatted content.
No (not built-in). Markdown is global. However, users can switch to HTML/Text format individually using the format switcher.
Not by default. Parsedown generates <pre><code> blocks without syntax highlighting. You can add syntax highlighting by:
Example (Prism.js):
document.querySelectorAll('pre code').forEach((block) => {
Prism.highlightElement(block);
});
Not via UI. The toolbar is hard-coded in js/markdown-editor.js. To customize:
js/markdown-editor.jstoolbar array in createMarkdownToolbar()No. This plugin requires osTicket 1.18.x because it uses the ThreadEntryBody class introduced in 1.18.
For osTicket 1.17, you would need to:
Yes! The plugins work together seamlessly. Use format=markdown in the API Endpoints Plugin's CREATE/UPDATE endpoints.
Manually: Edit each thread entry and switch to Markdown format using the format switcher.
Bulk Migration (Advanced):
-- Convert all "text" entries to "markdown" (example only, test first!)
UPDATE ost_thread_entry
SET format = 'markdown'
WHERE format = 'text' OR format IS NULL;
Warning: This converts ALL entries. Test on a staging server first!
The plugin itself is language-neutral. The Markdown editor will work with RTL languages (Arabic, Hebrew), but text direction must be configured in osTicket core, not the plugin.
Not directly. The plugin uses vanilla Parsedown with SafeMode enabled. To add custom extensions:
markdown-body.phpnew Parsedown() with your custom Parsedown instance$parsedown = new ParsedownExtra(); // Use ParsedownExtra
This plugin is released under the GNU General Public License v2, compatible with osTicket core.
See LICENSE for details.
For questions or issues, please create an issue on GitHub:
Issue Tracker: https://github.com/markus-michalski/osticket-markdown-support/issues
When reporting issues, please include:
php -v)Developed by Markus Michalski
Contributions welcome!
See CHANGELOG.md for version history.