2

I have an unusual problem with KDE in Arch Linux. In particular, Dolphin detects files with the .md file extension as MATLAB rather than Markdown files, but only when the file's first two characters are ## (yes, really).

Here is a simple test I did from the shell:

[jason@jasons-laptop Desktop]$ xdg-mime query filetype test-1.md
text/x-matlab
[jason@jasons-laptop Desktop]$ cat test-1.md
## test
[jason@jasons-laptop Desktop]$ xdg-mime query filetype test-2.md
text/markdown
[jason@jasons-laptop Desktop]$ cat test-2.md
Test

Does anyone have any idea what is causing this bug, or how to fix it? I've tried using update-mime-database, but it doesn't seem to help. I would consider filing a bug report, but I'm not really sure what program is responsible.

1 Answer 1

1

I've figured it out! I had to add the following lines to ~/.local/share/mime/packages/Override.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mime-info>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
        <mime-type type="text/markdown">
                <magic priority="50"><match value="##" type="string" offset="0"/></magic>
        </mime-type>
</mime-info>

And then run update-mime-database /home/[username]/.local/share/mime.

I'm still not quite sure why ## causes files to be detected as MATLAB by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .