Skip to content

fix: register markdown MIME types in desktop file - #691

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/markdown-mimetype
Oct 26, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/markdown-mimetype

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add text/markdown and text/x-markdown to the MimeType field of deepin-editor.desktop, so Text Editor appears in the "Open With" menu for .md files.

Problem

On current bases shared-mime-info detects .md files as text/markdown (a subtype of text/plain). The desktop file never declared this type, and the file-manager "Open With" list is built by exact MIME-type matching, so Text Editor was missing from the menu for .md files while it still appeared for .txt.

text/x-markdown is declared as well for compatibility with older bases where .md resolves to that type.

Changes

  • deepin-editor.desktop: append text/markdown;text/x-markdown; to MimeType

Testing

  • desktop-file-validate passes
  • Verified with a simulated install (XDG data dir + generated mimeinfo.cache): gio mime text/markdown now lists deepin-editor in recommended apps (before the fix only Typora was listed)
  • Rebuild the package and check the "Open With" menu for .md files in the file manager

PMS: TASK-396619

Summary by Sourcery

New Features:

  • Register Markdown MIME types so the Text Editor appears as an Open With option for Markdown files.

1. Add text/markdown and text/x-markdown to the MimeType field
2. .md files are detected as text/markdown instead of text/plain
3. Text Editor was missing from the "Open With" menu for .md files

Log: Text Editor now shows up in the "Open With" menu for .md files

Influence:
1. Right-click a .md file and check Text Editor appears in Open With
2. Set Text Editor as the default app for .md and verify it opens fine
3. Right-click a .txt file and confirm Text Editor still appears

fix: 桌面文件注册 markdown MIME 类型

1. MimeType 字段添加 text/markdown 与 text/x-markdown
2. .md 文件被识别为 text/markdown 而非 text/plain
3. 修复 .md 文件打开方式菜单缺少文本编辑器的问题

Log: .md 文件的"打开方式"菜单中可以看到文本编辑器

Influence:
1. 右键 .md 文件,检查打开方式菜单中出现文本编辑器
2. 将文本编辑器设为 .md 默认打开方式,验证可正常打开
3. 右键 .txt 文件,确认文本编辑器仍出现在打开方式菜单中

PMS: TASK-396619
@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the desktop entry’s MimeType field to include both standard and legacy Markdown MIME types, allowing file managers and GIO to recommend Text Editor for .md files.

File-Level Changes

Change Details Files
Register Markdown MIME types so the desktop integration exposes Text Editor for Markdown files.
  • Add text/markdown support for current shared-mime-info mappings.
  • Add text/x-markdown compatibility support for older MIME databases.
  • Retain valid semicolon-delimited MimeType desktop-entry syntax.
deepin-editor.desktop

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更仅在 deepin-editor.desktop 文件的 MimeType 字段新增 text/markdown 与 text/x-markdown 两个 MIME 类型注册,用于使 deepin-editor 能够关联并打开 Markdown 文件。变更范围极小、风险极低,语法正确、逻辑清晰,四维度均无问题,OCR 审查与启发式扫描均未发现任何问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

# 无需修改,当前变更已正确实现 Markdown MIME 类型注册
# deepin-editor.desktop MimeType 字段已包含:
#   text/markdown;text/x-markdown;
# 该写法符合 freedesktop.org Desktop Entry 规范

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 9df19a3 into linuxdeepin:master Oct 26, 2026
17 checks passed
@pengfeixx
pengfeixx deleted the fix/markdown-mimetype branch October 26, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants