MarkEdit-app/MarkEdit

[Bug] Cannot open files with `.md` file ending

Closed this issue · 12 comments

I am not able to open files with .md file ending with MarkEdit. This encompasses

  • Files created with touch file.md and then attempting to open it
  • Files created with other MD Editors and then attempting to open it with MarkEdit
  • Files created with MarkEdit and saved as .md file and then attempting to open it again after closing the file

Files with .txt can be opened as usual with MarkEdit. Up to my knowledge the problem first occurred after the update to macOS 15. Seems to be somewhat linked to Issue #452 .

My stats are:

  • macOS 15.0.1 (24A348)
  • MarkEdit 1.20.0

image

@aschelle Thanks for the feedback. This typically happens when the system no longer thinks MarkEdit is an editor of "md".

Could you please:

  • Try if "*.markdown" works
  • Try different ways to open the file, like from the "File -> Open..." menu
  • Share name of "other MD Editors", I have seen several times other editors can break the file association

I am also on Sequoia, so there's very high possibility that it is related to other apps.

You may also want to check the default application for Markdown files and override it like this: https://github.com/MarkEdit-app/MarkEdit/wiki/Manual#making-markedit-the-default

Here's an example of how other apps can be involved: #448, it also mentions a command called mdls for troubleshooting.

What I can tell for now is that, some apps or some services, incorrectly assigned "md" to a wrong UTI (it should be net.daringfireball.markdown), the default app to open "md" is still MarkEdit, but MarkEdit doesn't recognize that UTI.

@aschelle I appreciate if you could try this debug build out:

MarkEdit.zip

Although I still don't understand what is breaking the file association, this build now recognizes and opens plain text files more aggressively. Regardless of the UTI used for markdown files, as long as they conform to plain text, MarkEdit should open them.

If this still doesn't work (it means someone did something really wrong), the only option may be to let MarkEdit recognize all file types—though that’s not the direction I want to take.

This one, can open any files: MarkEdit.zip

Thank you very much for the quick help.
Here come at least the answers to the first part (the debug build I will try later):

  • The *.markdown works fine
  • When trying to select *.md files in the open dialog, I can not do so. The *.md files are grayed out.
  • I also use iA Writer and VS Code for markdown editing
  • Making MarkEdit the default application also does not help. When choosing the default application, MarkEdit is also grayed out indicating it may not support *.md files.
  • I have deinstalled iA Writer but the issue remained (after restart and reinstalling MarkEdit from brew)

Using mdls -name kMDItemContentType -name kMDItemContentTypeTree -name kMDItemKind on a .md file I get

kMDItemContentType     = "com.unknown.md"
kMDItemContentTypeTree = (
    "com.unknown.md",
    "public.text",
    "public.data",
    "public.item",
    "public.content",
    "public.plain-text"
)
kMDItemKind            = "md Datei"

For .markdown I get

kMDItemContentType     = "net.ia.markdown"
kMDItemContentTypeTree = (
    "net.ia.markdown",
    "public.plain-text",
    "public.text",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemKind            = "Markdown"

So something seems to be odd. Is there a way to fix these properties?

This is a very interesting finding: com.unknown.md

I don't know which app contributed to this, but it looks like that explains.

So the system thinks the UTI of md on your machine is com.unknown.md, but MarkEdit doesn't register this type, and the system still uses MarkEdit to open the app...

Could you please try the first MarkEdit.zip?

So the first MarkEdit.app.zip solves the problem. I can open the file both from command line and with the open file dialog as well as the open recent dialog.

This is a good news, thank you!

It looks like some app incorrectly mapped md to com.unknown.md, and public.text (the root of all text files, including rich text...)

MarkEdit used to only register plain text files, seems I will have to add com.unknown.md and public.text too.

Hi @aschelle could you please check if this build still works? MarkEdit (new).zip

This is created by adding com.unknown.md and a few others I found from: sbarex/QLMarkdown#59.

Thanks.

This still works. 😊

As a small add-on: Also the Quick-Look works now fine. This was also not the case before. I would assume the same reason behind it, right?

Thanks for confirming. Yes I think the reason is that I previously used only the official UTI of markdown, which is net.daringfireball.markdown in QuickLook extension, and I also added these values.

I will make a change and tag a release tomorrow, you are encouraged to replace the debug build with a release build once you see an upgrade.

Thank you again for helping with the troubleshooting!

Perfect. Thank you very much for your quick help and the upcoming fix.

I really enjoy the app, thanks for all the effort you put into it!