You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when editing .md (Markdown) files in TinyFileManager, the Ace Editor (Advanced editor view) does not activate Markdown syntax highlighting by default. Instead, it falls back to plain text, while other file types like .js or .php are highlighted correctly.
Upon checking the code, I found that the editor mode is set using this line:
However, $ext resolves to 'md' for Markdown files, and Ace does not have a mode called md — it expects 'markdown'. As a result, syntax highlighting doesn't work out of the box for .md files.
Suggested Fix:
A simple conditional mapping like this solves the problem:
if ($ext === 'md') {
$ext = 'markdown';
}
You could either:
Add this line near where $ext is defined,
Or apply it just before the editor is initialized.
Why this matters:
Markdown is a very common format for README files, notes, and static content, so it would be great if it worked with proper highlighting by default.
Thanks for your great work on this project! TinyFileManager is incredibly useful and lightweight — really appreciated. 😊
The text was updated successfully, but these errors were encountered:
Basically a good idea as it requires less code! But I wonder if eventually ace-editor might become able to recognize md-files correctly in some future releases, which would make this modification obsolete again.
So it might be more sustainable to mark this modification as a temporay fix to be easily found & removed again in the future. Currently I use this:
<?php
/***********************************************
* Fix for ace editor:
* map .md extension to markdown mode
* needed because currently (2025/04/09) ace editor doesn't recognize 'md')
***********************************************/
if ($ext === 'md') {
$ext = 'markdown';
}
?>
Hi there,
I noticed that when editing
.md
(Markdown) files in TinyFileManager, the Ace Editor (Advanced editor view) does not activate Markdown syntax highlighting by default. Instead, it falls back to plain text, while other file types like.js
or.php
are highlighted correctly.Upon checking the code, I found that the editor mode is set using this line:
However,
$ext
resolves to'md'
for Markdown files, and Ace does not have a mode calledmd
— it expects'markdown'
. As a result, syntax highlighting doesn't work out of the box for.md
files.Suggested Fix:
A simple conditional mapping like this solves the problem:
You could either:
$ext
is defined,Why this matters:
Markdown is a very common format for README files, notes, and static content, so it would be great if it worked with proper highlighting by default.
Thanks for your great work on this project! TinyFileManager is incredibly useful and lightweight — really appreciated. 😊
The text was updated successfully, but these errors were encountered: