Markdown Support: Installation
Installing Markdown Support: plugin folder in include/plugins/markdown-support, dependencies, activation in the admin panel, update, deactivation and removal.
Markdown Support: Installation
Requirements
- osTicket 1.18.x
- PHP 8.0 or newer (
composer.jsondeclares>=7.4, but the code uses PHP 8.0 syntax) - Access to the file system of the osTicket server and to the admin panel
- Write permission for the web server user on
include/class.thread.php,include/.htaccessand theapi/directory (see below)
Install the plugin files
Option 1: release ZIP (recommended)
- Download the release ZIP from the GitHub releases and extract it.
- Copy the
markdown-supportfolder toinclude/plugins/in your osTicket directory.
The ZIP contains the runtime dependency Parsedown in the vendor/ folder.
Option 2: Git clone with Composer
cd /path/to/osticket/include/plugins
git clone https://github.com/markus-michalski/osticket-markdown-support.git markdown-support
cd markdown-support
composer install --no-dev
The plugin loads
vendor/autoload.phpon startup. In a Git checkout this folder does not exist until you runcomposer install, and the plugin cannot start.
The target path is include/plugins/markdown-support/ with plugin.php, class.MarkdownPlugin.php and config.php directly inside.
Activate the plugin
- In the osTicket Admin Panel, go to Manage > Plugins.
- Find Markdown Support in the list and activate it.
On activation the following happens:
- The plugin creates an instance itself if needed (singleton, note
Auto-created singleton instance). - It adds rules to
include/.htaccessthat allow static files (js,css, images, fonts) and PHP files underplugins/. - It copies
markdown-preview.phptoapi/markdown-preview.php(the live preview endpoint). - It stores the installed version in the plugin configuration.
- When the active plugin starts,
include/class.thread.phpis extended with acase 'markdown':. Before that the plugin creates the backupinclude/class.thread.php.markdown-backup.
The settings are described on the Configuration page.
A browser tab that is already open only gets the editor after the page is reloaded.
Update
Replace the folder include/plugins/markdown-support/ with the new version. On the next start the plugin compares the stored installed_version with the version in plugin.php. If it is older or empty, the plugin updates the .htaccess rules, copies the preview endpoint again and stores the new version.
Updating osTicket
The core patch in include/class.thread.php belongs to osTicket and is lost when an osTicket update replaces the file. The plugin behaves as follows:
- On the next start it finds no
case 'markdown':and patches the new file again. If a backup.markdown-backupalready exists, it does not overwrite it. The backup then still comes from the file of the old osTicket version. - On deactivation the plugin copies this old backup over
include/class.thread.phpand deletes it. That would replace the core file of the new osTicket version with the old one. - If you delete the backup by hand instead, deactivation restores nothing and the patch stays in the new core file. The plugin recognizes the existing
case 'markdown':and does not create a new backup.
Therefore deactivate the plugin before the osTicket update. This restores the original file and deletes the backup. Then apply the osTicket update and activate the plugin again. It then creates a fresh backup of the new file and patches it.
Deactivate and remove
- Deactivate: In the admin panel under Manage > Plugins, deactivate the plugin. The plugin then restores
include/class.thread.phpfrom the backup (and deletes the backup), removesapi/markdown-preview.phpand removes its rules frominclude/.htaccess. - Remove: Deactivate first, then uninstall the plugin in the admin panel and delete the folder
include/plugins/markdown-support/.
The plugin does not delete any database data. Existing entries keep the format markdown in the format column and their Markdown text. How osTicket displays such entries without the plugin is decided by the osTicket core.