mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #1309] Advanced Editor: .md files not detected as Markdown – requires manual mapping #836
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#836
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @elektrischerwalfisch on GitHub (Apr 7, 2025).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/1309
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.jsor.phpare highlighted correctly.Upon checking the code, I found that the editor mode is set using this line:
However,
$extresolves 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.mdfiles.Suggested Fix:
A simple conditional mapping like this solves the problem:
You could either:
$extis 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. 😊
@yucho123987 commented on GitHub (Apr 8, 2025):
Maybe
path: "ace/mode/<?php echo $ext == 'md' ? 'markdown' : $ext; ?>",is better, I think.😁@elektrischerwalfisch commented on GitHub (Apr 9, 2025):
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: