gpt4 book ai didi

macos - 如何制作Spotlight索引减价文件?

转载 作者:行者123 更新时间:2023-12-03 12:19:21 25 4
gpt4 key购买 nike

对于 Markdown 文档,我通常使用.markdown或.md扩展名。不幸的是,除非它们具有.txt文件扩展名,否则Spotlight拒绝索引它们。

我在textmate博客上看到了涉及editing Info.plist files的可能解决方案。有没有更好的办法?

更新:我刚刚发现QuickLook generator for Markdown files,它添加了聚光灯支持和漂亮的HTML quicklook预览。它可以治疗!

最佳答案

通过创建系统RichText.mdimporter的副本,修改其Info.plist并将其保存在/ Library / Spotlight中,可以在不禁用SIP的情况下执行此操作。

cp -r /System/Library/Spotlight/RichText.mdimporter .
patch -p2 RichText.mdimporter/Contents/Info.plist < Markdown.patch
mv RichText.mdimporter Markdown.mdimporter
sudo cp -R Markdown.mdimporter /Library/Spotlight
mdimport -r /Library/Spotlight/Markdown.mdimporter

Markdown.patch
diff -ru RichText.mdimporter/Contents/Info.plist Markdown.mdimporter/Contents/Info.plist
--- RichText.mdimporter/Contents/Info.plist 2015-11-23 16:14:12.000000000 +0200
+++ Markdown.mdimporter/Contents/Info.plist 2015-11-23 16:10:03.000000000 +0200
@@ -13,15 +13,7 @@
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
- <string>public.rtf</string>
- <string>public.html</string>
- <string>public.xml</string>
- <string>public.plain-text</string>
- <string>com.apple.traditional-mac-plain-text</string>
- <string>com.apple.rtfd</string>
- <string>com.apple.webarchive</string>
- <string>org.oasis-open.opendocument.text</string>
- <string>org.openxmlformats.wordprocessingml.document</string>
+ <string>net.daringfireball.markdown</string>
</array>
</dict>
</array>
@@ -30,11 +22,11 @@
<key>CFBundleGetInfoString</key>
<string>1.0, Copyright (c) 2004-2010 Apple Inc.</string>
<key>CFBundleIdentifier</key>
- <string>com.apple.MDImporter.RichText</string>
+ <string>com.apple.MDImporter.Markdown</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
- <string>Rich Text Sniffer</string>
+ <string>Markdown Sniffer</string>
<key>CFBundleShortVersionString</key>
<string>6.9</string>
<key>CFBundleSupportedPlatforms</key>

关于macos - 如何制作Spotlight索引减价文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/365669/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com